Guidance Forums / Reginald Rexx / List controls

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. List controls
Posted by: Michael S 2007-08-11 21:58:32
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


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')
/* After the next line, count will contain the number of lines in the listbox */
count = linesinlistbox(handle, 395)	

IF count = 0 THEN

DO i = 1 TO count
	contents.0 = contents.0 + 1
	/* Get the next line in the list */
  listboxline(handle, 393, i - 1, myline)
  contents.[contents.0] = myline

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 ?
Posted by: Jeff Glatt 2007-08-12 00:32:03
You don't really need the stem variable if you're doing the above, and you don't need to handle any events for the listbox.

You don't need to "clean up" the FUNCDEF'ed functions. Reginald does that automatically when your script ends. But it's better to FUNCDEF them once at the start of your script rather than repeatedly later on.
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
© Sat 2022-10-1  Guidance Laboratory Inc. Hits:0