• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

List boxes in dialog boxes

In TPW 1.5 I need to know how to put data (ie null strings) into list boxes which are in dialog boxes made in the resource workshop. I have tried setdlgitemtext with no luck, and the addstring command is a mystery. Thanks.
0
pobwest
Asked:
pobwest
  • 2
1 Solution
 
BigRatCommented:
Hi, it's that Rat again.
The long way round is to send the control a message LB_ADDSTRING
with SendDlgItemMessage :-
    SendDlgItemMessage(hDlg,IDD_LISTBOX,LB_ADDSTRING,0,
                   LongInt(Pchar(@CharArray)));
and that for each string (which here is in CharArray). The Message is LB_ADDSTRING, the wParam is zero and the lParam is the address of the string.

The AddString method to which you refer is when you have a TListBox *object*. You can create one of these with New
in a TDialog derivitive :-
    ListBox : PListBox;
    ListBox:=New(PListBox,InitResource(@self,IDD_LISTBOX));

The InitResource constructor takes the TDialog object (here as self) and the ID of the box. You can now call the AddString method :-
    ListBox^.AddString(String);
OK? or do you want further details?
0
 
pobwestAuthor Commented:
Thanks, thats what i was looking for.
0
 
BigRatCommented:
Then I'll answer the other one then.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now