You mean something like this? This is part of my tool "Hollywood Cubic Compiler":
Code: Select all
; callback function, which evaluates, which option was chosen
Function deSelectTargetOSOpt()
Local optswitch = scui.Get("optDeSelTargetOS") ; get the ID of the object in order to get infos about it
if optswitch.Value[0] = 1 ; if the "select all" button is pressed
; perform task A
ElseIf optswitch.Value[1] = 1 ; if the "deselect all" button is pressed
; perform task B
EndIf
EndFunction
; define the object
scui.NewObject(
#IFOCLASS_OPTIONS,
"optDeSelTargetOS",
{ x = 9, y = 290 },
{ x = 214, y = 25 },
nil,
{ Rows = 1,
Columns = 2,
Mode = #OPTMODE_ONLYONE,
Options = { "Select all",
"Deselect all" },
DefaultOptions = { }, ; nothing should be preselected
SwitchWidth = 20,
SwitchPosition = #OPT_LEFTSWITCH,
SwitchMode = #OPTSWITCH_FULLWIDTH },
{ OnChanged = deSelectTargetOSOpt } ; callback!
)
I hope this helps. If you any questions ...
EDIT:
Ah, sorry, I misunderstood you. You meant a list view ... So, let's take the example of Allanon's Demo_1.hws:
1. Define the listview:
Code: Select all
scui.NewObject( #IFOCLASS_LISTVIEW, "ListView", { x = 10, y = 4 },
{ x = 300, y = 100 },
nil,
{ FieldNames = { "Name", "Surname", "Age" },
Sizes = { 40, 30, 30 },
Entries = { { "Fabio", "Falcucci", "37" },
{ "Johnny", "Mnemonic", "36" },
{ "Clark", "Kent", "38" },
{ "Peter", "Pan", "14" },
{ "Takaya", "Todoroky", "23" },
{ "Aran", "Benjo", "24" },
{ "Mickey", "Mouse", "??" },
{ "Doraemon", "-", "??" },
{ "Lupin III","-", "??" },
{ "Rio", "Saeba", "35" }
}
},
{ OnChanged = ButtonID } ) ; callback!!!!
2. Now define the callback
before the Scui object definition:
Code: Select all
Function ButtonID(mess)
DebugPrint("---------------------> EVENT HANDLER TEST:", mess.id, mess.event)
; to get access to the table row and its values, access the data attribute in the mess variable
DebugPrint(mess.data[0]) ; "Fabio"; assuming, first row was clicked
DebugPrint(mess.data[1]) ; "Falcucci"; assuming, first row was clicked
DebugPrint(mess.data[2]) ; "37"; assuming, first row was clicked
; what really helps is Fabios great debugger helper! To be honest, I didn't know how to get the values, so I used this:
DBG.Console.Enable()
DBG.DumpTable(mess)
DBG.Console.Disable()
; somewhere here in the forums there must be the helpers. I will look, if I find them. Or do you have them?
EndFunction
Regards