Events: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
Brendon (talk | contribs)
No edit summary
Line 1: Line 1:
SUB ObjectName_Event[(arglist)] <br />
SUB ''ObjectName_Event''[(''arglist'')] <br />
:[Statements] <br />
:[''Statements''] <br />
END SUB
END SUB


'''Description'''
'''Description'''


Object events are triggered either programmatically or through user interaction. When an event is triggered, an object calls a SUB procedure in the program. The name of the procedure, ObjectName_Event, is a combination of the object name and the name of event. The optional component, arglist, is a comma-separated list of arguments that may be included in the procedure call by some events.  
Object events are triggered either programmatically or through user interaction. When an event is triggered, an object calls a SUB procedure in the program. The name of the procedure, ''ObjectName_Event'', is a combination of the object name and the name of event. The optional component, ''arglist'', is a comma-separated list of arguments that may be included in the procedure call by some events.  


'''Table 9: Object Events'''
'''Table 9: Object Events'''

Revision as of 04:04, 4 July 2012

SUB ObjectName_Event[(arglist)]

[Statements]

END SUB

Description

Object events are triggered either programmatically or through user interaction. When an event is triggered, an object calls a SUB procedure in the program. The name of the procedure, ObjectName_Event, is a combination of the object name and the name of event. The optional component, arglist, is a comma-separated list of arguments that may be included in the procedure call by some events.

Table 9: Object Events

Event Comments
Change ComboBox (item selected or text input), ListBox (item selected), TextBox (Text changed)
Click
DblClick ListBox, TextBox
DropDown COmboBox, Date
GotFocus Object activated to receive keyboard input
Form_Hide Generated code – do not modify
Form_Load Called from Form_Show
Form_Show Generated code – do not modify
Form_Unload Called from Form_Hide
KeyDown Keycode, shift as args

Shift=1, 2-CTRL, 4=Alt

KeyPress Char as arg
KeyUp Keycode, shift as args

Shift=1, 2-CTRL, 4=Alt

LostFocus Object deactivated
Output_Close Called when app is closed
Output_Size Called when output size is changed or screen rotated
Timer CheckBox, ComboBox, CommandButton, Frame, HScrollBar, Label, ListBox, OptionButton, TextBox, VScrollBar

Note: If a program does not have a procedure to respond to an event when it is called, no error will occur.

Example

REM Object Events Example
'Object Events call procedures in theprogram
DIM When
ADDOBJECT "ComboBox","Combo", 5, 30, 150, 80
Combo.Style = 2
SUB Combo_DropDown
  Combo.Clear
  Combo.AddItem DATE
  Combo.AddItem DATEADD("d", 1, DATE)
  Combo.AddItem DATEADD("ww", 1, DATE)
END SUB
SUB Combo_Click
  When = Combo.Text
  PRINT "Item selected: " & When
END SUB

Output

*

Related Items

Methods, properties,Properties