Fw: TListBox

Shane Miller SMiller1 at stvgb.org
Wed Feb 9 09:28:48 EST 2000


The Listbox.Items.Add should notify the control that an item was added.  Once that occurs, a sendmessage is required to add the new item to the gtkListbox.

In windows, the Add calls a "Changed" message handler (Not actually sure what it's called off hand).  The changed message is passed to the highest level handler, which in this case would be TListbox.  Once that occurs, TListbox would call a SendItemDlgMessage or one of those API calls to actually add the item to the "Windows" control.  This needs to be done by us in the LCL.  In our case, the sendmessage gets called, then in WIN32 case the API function gets called.  In GTK's case it calls gtkobject.inc and it's handled there.

To update CVS, please simply post your new files to the borad (remember to do a cvs update first so you have the latest changes merged into your code).  Once we see your changes and test them we will eventually give you write access to the CVS tree.

Also, feel free to post these messages directly to lazarus at miraclec.com 

Thanks
Shane

>>> Hans-Joachim Ott <hjott at compuserve.com> 02/07/00 05:08PM >>>
Shane Miller wrote:

>
> ----- Original Message -----
> From: "Hans-Joachim Ott" <hjott at compuserve.com>
> To: <smiller at lakefield.net>
> Sent: Saturday, February 05, 2000 7:11 PM
> Subject: TListBox
>
> > Hi Shane,
> >
> > some days ago, I found out that the Lazarus project exists. Since I'm
> > very interested in porting some of my Delphi applications to Linux, I
> > immediately loaded down the sources and made some experiments. It's
> > great what you are doing!
> > I tried to port a simple form containing some buttons and a listbox, and
> > now I've got some questions:
> >
> > - In TCustomListBox.Create, the line "FItems:=
> > TStrings(Pointer(SendMessage(LM_GETITEMS, Self, nil)));" is commented
> > out and replaced by "FItems := TStringList.Create;", so I got an empty
> > listbox. I made some changes and it works now, so the question is: Is
> > your intention to abandon the handling with TGtkListStringList and to
> > introduce something like TListBoxStrings in Delphi (cf. stdctrls.pas
> > from Delphi 1)? Or did you simply not have the time yet to fix it?
> >
>
> When the listbox is created, you SHOULD get an empty list.  After that, the call to getitems should be used to get the items in the listbox.  But initially the create of a blank TStringList seems to be correct.

When FItems is created as TStringList and you call then ListBox.Items.Add() to put something into the listbox, it is only added to the StringList but not to the gtk widget, so you don't get any lines in your listbox. When FItems are
created as TGtkListStringList (not in TListBox.Create, that gives a crash, but at first use), then ListBox.Items.Add() works as expected.

>
>
> > - In my Windows applications, I'm using "owner draw" listboxes so I can
> > display data in columns with a variable font. In the GTK documentation,
> > I didn't find anything about "owner draw", but the GTK CList widget
> > seems to support columns. Will there be support of the owner draw style
> > in Lazarus, or is it impossible because GTK does not support it? Do you
> > plan to use CList instead of List widgets in the future?
> >
> > I hope you find the time to send me an answer.
>
> I'm afraid I haven't looked into that yet.  I am not concentrating on the TListBox at this point.  I am working on getting the editor up and running.  The TListbox will be needed for this, but it's not a needed part at this point.
>
> Feel free to look at it and find methods for improving/finishing the TListbox.  We need all the help we can get.

I'll check what I can do. I got the latest sources from CVS, could you let me know what I have to do when I have some code ready to deliver?

>
> >
> > Kind regards,
> >
> > Hans
> >
> > ---------------------------------------------
> > Hans-Joachim Ott, Grimmigweg 9, 75179 Pforzheim, Germany
> > hjott at compuserve.com 
> >

--
Hans-Joachim Ott, Grimmigweg 9, 75179 Pforzheim, Germany
hjott at compuserve.com 








More information about the Lazarus mailing list