NavBar: Difference between revisions
Line 39: | Line 39: | ||
MsgBox "Button pressed: " & choice | MsgBox "Button pressed: " & choice | ||
End Function | End Function | ||
</pre> | |||
Change the text on a NavBar item: | |||
<pre> | |||
NavBar1_0.innerHTML="one" | |||
NavBar1_0.innerHTML="two" | |||
</pre> | </pre> | ||
Revision as of 16:40, 10 February 2014
Description
The Navbar control puts up to 5 buttons anyplace on the form. Buttons can be text, an icon or both. When clicked, <NavBarID>_onclick(choice) is called. The name of the button which is called is in choice. If the text of the button has a space in it, it is replaced by an underbar. For example, "Edit Text" will call onclick with "Edit_Text"
To add a control to your app, choose the control’s icon in the Toolbar, then position it on the Design Screen. Use the Property Editor to set the properties you need, then add functions to your code to respond to the events that come from the control: usually, just onclick.
To select and unselect buttons in code:
$("#NavBar1_0").addClass("ui-btn-active") $("#NavBar1_1").removeClass("ui-btn-active")
Properties
Standard properties are supported, plus:
ChangeForm | A comma separated list of form names to go to if a button is clicked. |
items | A list of names for the buttons, comma separated. |
iconPos | The position of the icon. Can be none, top, bottom, left, right or notext. |
icons | Names of icons for each button. 18 to choose from: alert, arrow-d, arrow-l ,arrow-r, arrow-u ,back, check, delete, forward, gear, grid, home, info, minus, plus, refresh, search, star. |
Events
Standard events are supported. However, events are not usually associated with the control.
Example
Function NavBar1_onclick(choice) If TypeName(choice)="object" Then Exit Function MsgBox "Button pressed: " & choice End Function
Change the text on a NavBar item:
NavBar1_0.innerHTML="one" NavBar1_0.innerHTML="two"
Output
(message box showing “Button pressed: 1”)