07-18-2006 10:20 AM
07-18-2006 10:40 AM
GetCtrlVal(panel, control, void *val) will return the actual "value" of the item selected.
GetCtrlIndex(pane, control, int *val) will the zero-based number that the selected item is within the list.
GetValuefromIndex, getindexfromValue, and getlabelfromiIndex are all functions that will convert these data into other relevant data.
07-18-2006 11:05 PM
thanks scomack..i tried all those control functions...
but what i require is... consider when we move around a listbox with checkmark option,
i want to highlight the item which i clicked..so can u suggest me the best to do this..
07-19-2006 02:16 AM
Hello,
could you explain exactly what you would like to do? When you click a List item, the item will be highlighted automatically. There is no need to program this.
If you want to know which List item is clicked, you can get the index from the function GetIndexFromPoint. The mouse coordinates are stored in the callback function parameters evenData1 (y) and eventData2 (x) when the parameter event equals EVENT_LEFT_CLICK.
07-19-2006 03:46 AM
07-19-2006 04:12 AM
Hello,
if I understand the problem correct, this is what you should do: Edit the List Box by double clicking it in the UIR editor. Click the List Box Options button and enable the check box 'Text Click Toggles Check'. Now, when you click an item in the List Box, the action is the same as when you would have clicked the item's checkbox.
07-19-2006 05:23 AM
sorry wim u misunderstand my pblm...
what i need is i dont want to make the listbox item state changed when i click listbox item name..
so i edit the lisbox option, disable the option text clicks toogle checkmark already..
what i need is if i click the listbox item text it shouldnt change its state..
but i want the item index of the lisbox item. when i click it ....
waiting for ur reply
sks
07-19-2006 06:28 AM
Hello sks,
If you just want the index of the clicked item, why not using my previous suggestion:
If you want to know which List item is clicked, you can get the index from the function GetIndexFromPoint. The mouse coordinates are stored in the callback function parameters evenData1 (y) and eventData2 (x) when the parameter event equals EVENT_LEFT_CLICK.
Your callback function should look like this:
int CVICALLBACK ListBoxCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) {
int index;
switch (event) {
case EVENT_LEFT_CLICK:
GetIndexFromPoint(pnl, PNL_LISTBOX, MakePoint (eventData2, eventData1), &index, 0, 0);
DebugPrintf ("Index: %i\n", index);
// Do whatever you want to do with the list item...
break;
}
return 0;
}
07-19-2006 07:54 AM
thanks wim ..
getindexfrompoint control function works perfectly..
sks