PDA

View Full Version : SWAPI.PLL - buggy proc Edit_LoadFromList


csandman
12-31-2006, 09:35 PM
Hi,

did some exercises to learn about PPL.
IMHO the proc Edit_LoadFromList is buggy and won't work.
See original ListToStr (Parameter wrong) and original Sendmessage (Parameters mixed)

If you like, take the following code:

proc Edit_LoadFromList(edit$, slist$)
local(s$);
s$ = ListToStr(slist$, "\n", "", "");
SendMessage(edit$, WM_SETTEXT, 0, s$);
end;

Regards
csandman

kornalius
01-01-2007, 02:30 AM
Try the Edit_Set() which uses the same SendMessage() function. If this one works, Edit_LoadFromList() should work.

I don't see what could be wrong with Edit_LoadFromList(). Please develop further.

PointOfLight
01-01-2007, 02:52 AM
Here's the current code from Edit_LoadFromList:

proc Edit_LoadFromList(edit$, slist$)
local(s$);
ListToStr(slist$, "\n", "", s$);
SendMessage(edit$, WM_SETTEXT, s$, 0);
end;


The first problem is that the syntax for ListToStr is incorrect. The second problem is that the last 2 parameters in SendMessage are flipped. If you look at the code for Edit_Set, SendMessage is:

SendMessage(edit$, WM_SETTEXT, 0, str(text$));

csandman is correct in that replacing the current Edit_LoadFromList with the code he provided should fix the problem.

kornalius
01-01-2007, 05:11 PM
Thanks Eric. I didn't get a change to test the function yet.