I feel we've had this discussion before, but can't remember/find it.
A problem I have in a number of scripts is stem variables tied to a list control. I might allow the user to add or delete rows - this part is easy using either
guiremovectltext("exe_List", exe_list.i)
guisendmsg("dll_List", "ADDSTRING", ,exe_list.i)
The problem arises when I then want to do something with the resulting list control contents. Based on the examples above, I might want/need to do steminserts/stemdeletes as well to keep the "source" stem in synch with the list control.
Another way you showed me once was code similar to the following
OPTIONS "WINFUNC"
USE ARG handle, list_contents.
contents.0 = 0
FUNCDEF('LinesInListbox', '32u, void, 32u, 32u, 32u', 'user32', 'SendMessage')
FUNCDEF('ListboxLine', '32u, void, 32u, 32u, str[256] stor', 'user32', 'SendMessage')
count = linesinlistbox(handle, 395)
IF count = 0 THEN
RETURN 0
DO i = 1 TO count
contents.0 = contents.0 + 1
listboxline(handle, 393, i - 1, myline)
contents.[contents.0] = myline
END
RETURN 0
2 questions :-
1 Is there a better way of getting the contents 2 If not, then using the above, I never need to bother about the source stem - I just call the above code and I have the contents. Having said that, should I do some sort of clean up on the FUNDEF'ed functions ? |