Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2000-02

Fw: TListBox

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Shane Miller

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

Thanks
Shane

>> Hans-Joachim Ott 02/07/00 05:08PM >>>
Shane Miller wrote 26 lines
----- Original Message ----- From: "Hans-Joachim Ott" To: 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.

Show quoted text 14 lines
> - 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?

Show quoted text 10 lines
> > Kind regards, > > Hans > > --------------------------------------------- > Hans-Joachim Ott, Grimmigweg 9, 75179 Pforzheim, Germany > >
Hans-Joachim Ott, Grimmigweg 9, 75179 Pforzheim, Germany

Reply by email

Shane Miller

You can send me the files. I would like to see it. Is it a ListView? Is it something new? I'll take a look at the code and your example to see what it is before adding it.

Thanks
Shane Miller

>> 02/22/00 05:59PM >>>

Hello Shane!

As you might remember, I'm interested in having a listbox in Linux which has columns. Since I found no way to have it with the current implementation based on the Gtk List widget, I made some code to have it based on the CList widget. It seems that it's much more easy to use than the List widget and it supports columns and other stuff currently not implemented in lcl, e.g. ListBox.Items.Objects[] and ..Items.Begin/EndUpdate. Also the Gtk tutorial prefers the CList widget. As a start, I've
- added a new component (csCListBox) to vclglobals.pp
- added some blocks for csCListBox to gtkobjects.inc
- added a GtkCListStringList to gtklistsl(h).inc
- created a component TCListBox = class(TListBox)
- made a small form containing some buttons and such a listbox, to test it

It has currently all the functionality of csListBox, plus ListBox.Items.Objects[], and it seems to work. Before I add more functionality (which might require new LM_ messages), I'd like to know if you would like to put this code into lcl, to replace csListBox (or maybe as add-on?), or if I should move my code into a unit of my own and make a separate component. Shall I send you the files?

Kind regards, Hans

_________________________________________________________________ To unsubscribe: mail with
"unsubscribe" as the Subject
archives at http://www.miraclec.com/list_archives/lazarus

Reply by email

Hans-Joachim Ott

Hello Shane!

As you might remember, I'm interested in having a listbox in Linux which has columns. Since I found no way to have it with the current implementation based on the Gtk List widget, I made some code to have it based on the CList widget. It seems that it's much more easy to use than the List widget and it supports columns and other stuff currently not implemented in lcl, e.g. ListBox.Items.Objects[] and ..Items.Begin/EndUpdate. Also the Gtk tutorial prefers the CList widget. As a start, I've
- added a new component (csCListBox) to vclglobals.pp
- added some blocks for csCListBox to gtkobjects.inc
- added a GtkCListStringList to gtklistsl(h).inc
- created a component TCListBox = class(TListBox)
- made a small form containing some buttons and such a listbox, to test it

It has currently all the functionality of csListBox, plus ListBox.Items.Objects[], and it seems to work. Before I add more functionality (which might require new LM_ messages), I'd like to know if you would like to put this code into lcl, to replace csListBox (or maybe as add-on?), or if I should move my code into a unit of my own and make a separate component. Shall I send you the files?

Kind regards, Hans

Reply by email