Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / List controls

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. List controls
#11457
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

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

IF count = 0 THEN
 	RETURN 0 

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
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 ?
Message2.
#11460
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.
Email:webmaster1g.yi.org Hits:0