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.
Trainee
Date of registration: Nov 24th 2008
Location: Cologne, Germany
Occupation: Second Vice President of Distributed Junk and Trash Development
Jabaco Source |
|
1 2 3 4 5 6 7 |
Public Sub Usercontrol_Initialize() CreateToolBar End Sub Private Sub CreateToolBar() ToolBar.createToolBarItem "tabAdd", vbNullString, "Add", AddPng End Sub |
Quoted
java.lang.Exception: CallByName 'createToolBarItem' failed!
at VBA.Interaction.CallByName(Interaction.java:186)
at VBA.Interaction.CallByName(Interaction.java:184)
at VBA.Interaction.CallByName(Interaction.java:175)
at uctrlProducts.CreateToolBar(uctrlProducts.jsrc:10)
at uctrlProducts.Usercontrol_Initialize(uctrlProducts.jsrc:2)
at VB.Usercontrol.fireLoaded(Usercontrol.jsrc)
at VB.LoadAdapter.run(LoadAdapter.jsrc)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Trainee
Date of registration: Nov 24th 2008
Location: Cologne, Germany
Occupation: Second Vice President of Distributed Junk and Trash Development
Quoted from "A1880"
Wie man kaum einer PictureBox oder einem Frame eine ToolBar verpassen würde, so fällt mir auch keine Begründung dafür ein, es bei einem Usercontrol zu versuchen.
Intermediate
Date of registration: Jan 1st 2009
Location: Hanover, Germany
Occupation: Software Engineer
Hobbies: Hilbert Curves
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Option Explicit Implements ActionListener Private Const PreferredBtnHeight As Integer = 26 Private Const PreferredBtnWidth As Integer = 26 Public Event ButtonClick(ActionCmd As String) Public Sub ToolBar Me.setVisible(True) Me.setLocation(0, 0) Me.setFloatable(False) End Sub Public Sub AddButton(Text As String, ToolTip As String, ActionCmd As String) Dim btn As New JButton btn.setText(Text) btn.addActionListener(Me) btn.setToolTipText(ToolTip) btn.setActionCommand(ActionCmd) btn.setSize(PreferredBtnWidth, PreferredBtnHeight) Me.add(btn) End Sub Public Sub actionPerformed(arg2 As ActionEvent) RaiseEvent ButtonClick(arg2.getActionCommand) End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Option Explicit Dim Withevents ToolBar As New ToolBar Public Sub Usercontrol_Initialize() Me.add(ToolBar) ToolBar.setSize(Me.Width, 26) ToolBar.AddButton("ABC", "dings ABC", "ABC") ToolBar.AddButton("DEF", "dings DEF", "DEF") End Sub Sub ToolBar_ButtonClick(ActionCmd As String) Select Case ActionCmd'.getActionCommand Case "ABC": MsgBox("The ABC Button was pressed in " & "UserControl1") Case "DEF": MsgBox("The DEF Button was pressed in " & "UserControl1") End Select End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Option Explicit Dim Withevents TB As New ToolBar Public Sub Form_Load() Me.add(TB) TB.setSize(Me.Width, 26) TB.AddButton("ABC", "dings ABC", "ABC") TB.AddButton("DEF", "dings DEF", "DEF") End Sub Sub TB_ButtonClick(ActionCmd As String) Select Case ActionCmd'.getActionCommand Case "ABC": MsgBox("The ABC Button was pressed in " & "Form1") Case "DEF": MsgBox("The DEF Button was pressed in " & "Form1") End Select End Sub |