[Re: Fw: TListBox]

Michal Bukovjan mbukovjan at netscape.net
Thu Feb 10 11:03:23 EST 2000


Last time I checked the TListBox was working well. I'll look why was the
internal list changed back to TStringList - it makes no sense. The
TGtkListStringList was created and should be used as a counterpart to
TListBoxStrings found in Delphi, which looks up the strings in the underlying
Win32 list box. This way, the list box items are not held twice in memory.
Since the TListBoxStrings is Win32 specific, hence the need for
TGtkListStringList. Note that the TListBox only knows in has TStrings, it does
not now about concrete descendant, which is determined in the interface
object.

The same technique is used for items of TComboBox.

I'll try to fix it today for GTK. Other platform maintainers can just create
plain TStringList in their interface objects, if they don't feel like
interfacing with their own native GUI controls. I also check the crash, maybe
this happens because the creation order of various things changed.

I am not sure about the Changed handler (you mean OnChange of TStrings?) but
that should be pretty straightforward to implement.

About the OwnerDraw : I thought about this a long time, and still am not
really sure how to implement this. Maybe we could recheck this once the
TCanvas is propbably working, so that we can supply our own canvas for GTK. If
you have any ideas what would be the best way, feel free to implement them or
suggest something :-)

Regards,

Michal Bukovjan

"Shane Miller" <SMiller1 at stvgb.org> wrote:
> 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 
> 
> 
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus


____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com.






More information about the Lazarus mailing list