Thursday, May 17th 2012, 4:47pm UTC+2

You are not logged in.

  • Login
  • Register

Manuel

Administrator

Posts: 255

Location: Erlangen, Germany

Occupation: Software Developer

1

Friday, August 22nd 2008, 2:33am

Create Jabaco-Menu / Jabaco-ToolBar

You have to create the Jabaco-Menu in the "Form_Load()"-Routine. You'll find a MenuBar-Property inside the Jabaco-Form. Declare a new VBMenuGroup as parent item. Add a new VBMenuItem with VBMenuGroup-Owner. Similar with Seperator. It is possible to create an icon for each Menu-Item, add a new Image (Gif-,Jpg, Png-File) to the Jabaco-Resource-Manager. Example:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
Public Sub Form_Load()
   Dim tmpGroupFile As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(Nothing, "File", "File", True, NewPng)
   Dim tmpMenuNew As VB#VBMenuItem = Me.MenuBar.createMenu(tmpGroupFile, "New", "New")
   Dim tmpMenuOpen As VB#VBMenuItem = Me.MenuBar.createMenu(tmpGroupFile, "Open", "Open")
   Dim tmpGroupSubItem As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(tmpGroupFile, "SubItem", "SubItem")
   Dim tmpGroupSubSubItem As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(tmpGroupSubItem, "SubSubItem", "SubSubItem")
   Dim tmpGroupSubSubSubItem As VB#VBMenuItem = Me.MenuBar.createMenu(tmpGroupSubSubItem, "SubSubSubItem", "SubSubSubItem")
   Call Me.MenuBar.AddSeperator(tmpMenuFile)
   Dim tmpMenuClose As VB#VBMenuItem = Me.MenuBar.createMenu(tmpGroupFile, "Close", "Close")
End Sub

You could handle the Click Event inside the Form with "Form_MenuClick(MenuItem As VB#IMenuItem)".

Jabaco Source

1
2
3
Public Sub Form_MenuClick(MenuItem As VB#IMenuItem)
   MsgBox "Caption: " & MenuItem.Caption & " - ControlID: " & MenuItem.ControlID
End Sub

Similar with the ToolBar:

Jabaco Source

1
2
3
4
Public Sub Form_Load()
   Call Me.ToolBar.createToolBarItem("New", "New", "ToolTip", NewPng, fmPicturePositionCenter)
   Call Me.ToolBar.createToolBarItem("Open", "Open", "ToolTip", OpenPng, fmPicturePositionCenter)
End Sub

Handle the Events:

Jabaco Source

1
2
3
Public Sub Form_ToolBarClick(ToolBarItem As VB#IToolBarItem)
   MsgBox "ControlID: " & ToolBarItem.ControlID
End Sub


Just try it.

beic

Beginner

2

Friday, February 19th 2010, 5:31pm

Hi Manuel,

It is very simple and easy :thumbup: , but how to add a separator line to the ToolBar and how to place a caption bellow ToolBar icon? ?(

Thank you for helping me out!!!

Best regards,
Viktor
I think it will be a good replacement for VB6 after a little improvements and minor bug fixes... :rolleyes:

This post has been edited 1 times, last edit by "beic" (Feb 20th 2010, 2:02pm)


A1880

Intermediate

Posts: 500

Location: Hanover, Germany

Occupation: Software Engineer

3

Saturday, February 20th 2010, 11:38am

I've managed to add a separator:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Option Explicit

Public Sub Form_Load()   
   Call Me.ToolBar.createToolBarItem("New", "New", "ToolTip New", Burning002Png, fmPicturePositionAboveLeft )
   Call Me.ToolBar.createToolBarItem("Open", "Open", "ToolTip Open", Burning002Png, fmPicturePositionCenter)
   Call Me.ToolBar.addSeperator
   Call Me.ToolBar.createToolBarItem("Tools", "Tools", "ToolTip Tools", Burning002Png, fmPicturePositionCenter)
   Call Me.ToolBar.addSeperator(5)
   Call Me.ToolBar.createToolBarItem("Help", "Help", "ToolTip Help", Burning002Png, fmPicturePositionRightCenter)
End Sub

Public Sub Form_ToolBarClick(ToolBarItem As VB#IToolBarItem)
   MsgBox "ControlID: " & ToolBarItem.ControlID
End Sub


Hoewever, the separator width and the position parameters don't seem to have any effect (yet).
Another item for the to-do list of the Jabaco framework contributers.

Greetings

A1880

beic

Beginner

4

Saturday, February 20th 2010, 2:10pm

Hi there,

Thank you for quick response, but I did the same thing like in your example code, but no separator(s) was displayed, until I figured out that the problem was in the Windows XP style/theme changes/settings
(causing these problems).

So leave the Windows XP default style/theme as is or find out what is wrong with uxtheme patcher!

Thank you again!
:thumbup:

Best regards,
Viktor

I think it will be a good replacement for VB6 after a little improvements and minor bug fixes... :rolleyes:

This post has been edited 1 times, last edit by "beic" (Feb 20th 2010, 4:47pm)


5

Thursday, February 25th 2010, 5:03am

For the Menu Items how do I add a separator because:

Source code

1
Call Me.MenuBar.addSeperator(tmpMenuFile)


Does not work.

A1880

Intermediate

Posts: 500

Location: Hanover, Germany

Occupation: Software Engineer

6

Thursday, February 25th 2010, 3:33pm

Please use the search facility of this forum. "addSeperator" (note the spelling error!) will show you the solution.

Greetings

A1880

Rate this thread
WoltLab Burning Board