You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Manuel

Administrator

  • "Manuel" is male
  • "Manuel" started this thread

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

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.

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

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

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

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)


j4ckkn1fe

Beginner

Posts: 6

Date of registration: Feb 23rd 2010

  • Send private message

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

  • "A1880" is male

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

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

Dani

Intermediate

Posts: 325

Date of registration: Nov 19th 2009

Location: GERMANY

  • Send private message

7

Sunday, December 23rd 2012, 7:51pm

Create Jabaco Menu / Jabaco ToolBar / PopUp Menu

Hey there,

I'd like to share a little code example on how to get a Components' RightClick, PopUp Menu or Context Menu

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Public Sub Form_Load()
   'ComponentPopUpMenu
   Dim List1PopupMenu As VB#VBMenuGroup = Me.MenuBar.createMenuGroup(Nothing, "ListPopUp", "ListPopUp", False)
   Dim List1PopupMenuItem1 As VB#VBMenuItem = Me.MenuBar.createMenu(List1PopupMenu, "List1PopupMenuItem1", "insert row", True, ActionaddGif)
   Dim List1PopupMenuItem2 As VB#VBMenuItem = Me.MenuBar.createMenu(List1PopupMenu, "List1PopupMenuItem2", "delete row", True, ActionremoveGif)
   List1.Parent.setComponentPopupMenu(List1PopupMenu.GetAsPopupMenu())
      
   'Sample Data for List1
   Dim i As Integer
   For i = 1 To 10
      List1.AddItem "initial row " & i
   Next i
   List1.ListIndex = 0
End Sub
 
Public Sub Form_MenuClick(MenuItem As VB#IMenuItem)
'   MsgBox "Caption: " & MenuItem.Caption & " - ControlID: " & MenuItem.ControlID
   If List1.ListIndex < 0 Then Exit Sub
   Select Case MenuItem.ControlID
      Case "List1PopupMenuItem1"
         List1.AddItem "added row " & List1.ListIndex + 2, List1.ListIndex + 1
      Case "List1PopupMenuItem2"
         List1.RemoveItem List1.ListIndex
   End Select
   List1.Refresh
End Sub


Happy Holidays,


Dani

Perry

Beginner

  • "Perry" is male

Posts: 40

Date of registration: Jan 15th 2011

Location: Sarasota, FL

Occupation: Cabinet Design

Hobbies: Programming

  • Send private message

8

Thursday, July 18th 2013, 1:46pm

Menubars Invisible

The menubars on a program I am making are contextual. That is I want them to appear in some circumstances but not in others.
I have found no examples of how to selectively make them invisible.
Can anyone help?


A small time Later:
Never mind. When I DL the Latest JAR file the problem was resolved.

Perry Miller

This post has been edited 1 times, last edit by "Perry" (Jul 18th 2013, 2:04pm)


Rate this thread
WoltLab Burning Board