Sign in Join

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

Mailing lists / lazarus / 2003-12

listbox patch

14 messages · 6 people ·

Reply by email Subscribe to this list Your subscription

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

Marc Weustink
to Vincent Snijders: win32. In win32 normal labels. I think the implementation in GTK is ok. different The…

+ From: Vincent Snijders
+ Sent: maandag 15 december 2003 9:42
+
+ > -----Oorspronkelijk bericht-----
+ > Van: Marc Weustink
+ > At 00:05 15-12-2003, Vincent Snijders wrote:
+ > >I noticed a different appearance / behaviour of the gtk-linux and
+ > >win32. In gtk clicking on the text selects the item, but does not
+ > >check it. In the win32 interface, clicking on the item text checks
+ > >the item. In win32 no selected item is shown.
+ >
+ > That is probably because GTK has no native checklistbox (it has no
+ > normal listbox like win32 either).
+ > GTK has a listbox with a list of widgets, which in normal cases are
+ > labels. When implementing the checklistbox, I saw no reason why
+ > those labels couldn't be labels and checkboxes. So in GTK you
+ > select the labels and check the checkboxes. I tried Checkboxes
+ > alone, but then you couldn't slecet an item without checking it.
+ I think the implementation in GTK is ok.

+ > Since the UI of GKT and win32 differs I had no problems with the
+ > different behaviour (we're not trying to let GTK widgets behave
+ > like windows)
+ The win32 implementation uses an OwnerDrawn listbox. I think it should
+ respect the selected state of an item.

Indeed

+ Now selected and not selected items are shown the same. Otherwise a
+ developer with gtk could think he could give some meaning to the
+ selected item (e.g. pushing a button will delete the selected item),
+ but with win32 the user doesn't see what the selected item is.

Indeed. Also if you dont show the selected state one could never (?) select items using the keyboard. Like selecting with cursor keys and ctrl and or shift. Then pressing space to toggle all selected checks. I think thsi is a common win32 feature.

Marc

Reply by email

Micha Nelissen
to Vincent Snijders: Attached patch enables storing objects in a listbox or checklistbox. The problems I…
Vincent Snijders wrote 5 lines
Attached patch enables storing objects in a listbox or checklistbox. The problems I predicted with the implementation came true. In some applications the destructor of the list called first and after that the LCL destroys the handle, sometimes it is the other way around. I think I have captured both cases in the patch.

Good work there, the patch looks good. I added a check for nil result.

Thanks,

Micha.

Reply by email

Vincent Snijders

Hi,

Attached patch enables storing objects in a listbox or checklistbox. The problems I predicted with the implementation came true. In some applications the destructor of the list called first and after that the LCL destroys the handle, sometimes it is the other way around. I think I have captured both cases in the patch.

I noticed a different appearance / behaviour of the gtk-linux and win32. In gtk clicking on the text selects the item, but does not check it. In the win32 interface, clicking on the item text checks the item. In win32 no selected item is shown.

Regards,
Vincent.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gz00052.gz
Type: application/octet-stream
Size: 2416 bytes
Desc: "listbox.patch.gz"
Url : http://localhost/pipermail/lazarus/attachments/20031214/a7347224/gz00052.obj

Reply by email

Marc Weustink
to Vincent Snijders

At 00:05 15-12-2003, Vincent Snijders wrote:

[SNIP]

I noticed a different appearance / behaviour of the gtk-linux and win32. In gtk clicking on the text selects the item, but does not check it. In the win32 interface, clicking on the item text checks the item. In win32 no selected item is shown.

That is probably because GTK has no native checklistbox (it has no normal listbox like win32 either).
GTK has a listbox with a list of widgets, which in normal cases are labels. When implementing the checklistbox, I saw no reason why those labels couldn't be labels and checkboxes. So in GTK you select the labels and check the checkboxes. I tried Checkboxes alone, but then you couldn't slecet an item without checking it.
Since the UI of GKT and win32 differs I had no problems with the different behaviour (we're not trying to let GTK widgets behave like windows)

Marc

Reply by email

Vincent Snijders
-----Oorspronkelijk bericht----- Van: Marc Weustink At 00:05 15-12-2003, Vincent Snijders wrote: >I noticed a different appearance / behaviour of the gtk-linux and

win32.

>In gtk clicking on the text selects the item, but does not check it.

In

>the win32 interface, clicking on the item text checks the item. In

win32

>no selected item is shown. That is probably because GTK has no native checklistbox (it has no

normal

listbox like win32 either). GTK has a listbox with a list of widgets, which in normal cases are

labels.

When implementing the checklistbox, I saw no reason why those labels couldn't be labels and checkboxes. So in GTK you select the labels and check the checkboxes. I tried Checkboxes alone, but then you couldn't slecet an item without checking it.

I think the implementation in GTK is ok.

Since the UI of GKT and win32 differs I had no problems with the

different

behaviour (we're not trying to let GTK widgets behave like windows)

The win32 implementation uses an OwnerDrawn listbox. I think it should respect the selected state of an item. Now selected and not selected items are shown the same. Otherwise a developer with gtk could think he could give some meaning to the selected item (e.g. pushing a button will delete the selected item), but with win32 the user doesn't see what the selected item is.

Vincent.

Reply by email

Micha Nelissen
to Vincent Snijders: Well, I have to look into this again, because the patch is not good enough. Lazarus still…
Vincent Snijders wrote 23 lines
>-----Oorspronkelijk bericht----- >Van: Micha Nelissen >Verzonden: maandag 15 december 2003 23:00 >Vincent Snijders wrote: > > >>Attached patch enables storing objects in a listbox or > >checklistbox. > >>The problems I predicted with the implementation came true. In some >>applications the destructor of the list called first and after that >>the LCL destroys the handle, sometimes it is the other way > >around. I > >>think I have captured both cases in the patch. > >Good work there, the patch looks good. Well, I have to look into this again, because the patch is not good enough. Lazarus still leaks a bit of memory when the debugger options dialog is used. (Tested both windows 98 and windows 2000). Further

I'd be surprised if this was the only place which is leaking memory ;-).

Micha.

Reply by email

Mattias Gaertner
to Vincent Snijders: Attached patch enables storing objects in a listbox or checklistbox. The problems I…
New CVS checkout this morning, compiled fine but when I try to run it: Gdk-WARNING **: locale not supported by Xlib, locale set to C

This is a Xlib warning. Do you get this with any other program?

Mattias

Show quoted text 58 lines
Gdk-WARNING **: can not set locale modifiers Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. NOTE: editor options config file not found - using defaults NOTE: miscellaneous options file not found - using defaults NOTE: codetools config file not found - using defaults Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. TMainIDE.DoNewProject A TMainIDE.DoNewEditorFile A NewFilename= TPascalParserTool.BuildTree B OnlyIntf=FALSE project1.lpr Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. [TCustomFormEditor.CreateComponent] Class='TFORM' TPascalParserTool.BuildTree B OnlyIntf=FALSE project1.lpr Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. TMainIDE.DoNewEditorFile end unit1.pas TMainIDE.DoNewProject end 0 TApplication.HandleException Access violation TApplication.HideAllFormsWithStayOnTop :TSPLASHFORM Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. TApplication.HandleException: there was another exception during showing the first exception TApplication.HandleException: there was another exception during showing the first exception [TMainIDE.Destroy] A lazarus.pp - unhandled exception [FORMS.PP] ExceptionOccurred Any idea what's up ? The system is slackware 9.1 -- "The reason Santa is so jolly is because he knows where all the bad girls live." A.J. Venter DireqLearn Tech Guru www.direqlearn.org www.silentcoder.cjb.net (personal site) _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email

Andrew Johnson
to Vincent Snijders: Attached patch enables storing objects in a listbox or checklistbox. The problems I…

this happened for me on my laptop as well, so I took a look, I am not for sure why, but for some reason GTK_RC_GET_STYLE is not always returning NIL in some situations. And a few places that use GetStyle don't check to make sure its returning a valid Style, thus the crash.

In any event, I have committed a change to use gtk_widget_get_style instead, and it appears to work again.

Andrew

A.J. Venter wrote 49 lines
New CVS checkout this morning, compiled fine but when I try to run it: Gdk-WARNING **: locale not supported by Xlib, locale set to C Gdk-WARNING **: can not set locale modifiers Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. NOTE: editor options config file not found - using defaults NOTE: miscellaneous options file not found - using defaults NOTE: codetools config file not found - using defaults Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. TMainIDE.DoNewProject A TMainIDE.DoNewEditorFile A NewFilename= TPascalParserTool.BuildTree B OnlyIntf=FALSE project1.lpr Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. [TCustomFormEditor.CreateComponent] Class='TFORM' TPascalParserTool.BuildTree B OnlyIntf=FALSE project1.lpr Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. TMainIDE.DoNewEditorFile end unit1.pas TMainIDE.DoNewProject end 0 TApplication.HandleException Access violation TApplication.HideAllFormsWithStayOnTop :TSPLASHFORM Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed. TApplication.HandleException: there was another exception during showing the first exception TApplication.HandleException: there was another exception during showing the first exception [TMainIDE.Destroy] A lazarus.pp - unhandled exception [FORMS.PP] ExceptionOccurred Any idea what's up ? The system is slackware 9.1

Reply by email

Vincent Snijders
Show quoted text 10 lines
-----Oorspronkelijk bericht----- Van: Micha Nelissen > > Well, I have to look into this again, because the patch is not good > enough. Lazarus still leaks a bit of memory when the debugger options > dialog is used. (Tested both windows 98 and windows 2000). Further I'd be surprised if this was the only place which is leaking memory ;-).

I am not using every part of the IDE, but I always compile lazarus with heaptrc enabled.

All the reproducable memory leaks, I encounter, I try to fix and send patches.
In a regular run no memory leaks occur.

Sometimes I have memleaks, which I can't reproduce. I remember two cases right now. I only have an indication from the backtrace where the leak occurs.
- In the designer during a drag and drop.
- In the codetools, when a declaration can't be found.

As I said, I can't reproduce them, so I can't locate and fix them. The debug options dialog memory leak is reproducable and will be fixed.

Vincent.

Reply by email

A.J. Venter
to Vincent Snijders: Attached patch enables storing objects in a listbox or checklistbox. The problems I…

New CVS checkout this morning, compiled fine but when I try to run it:

Gdk-WARNING **: locale not supported by Xlib, locale set to C

Gdk-WARNING **: can not set locale modifiers

Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed.
NOTE: editor options config file not found - using defaults NOTE: miscellaneous options file not found - using defaults NOTE: codetools config file not found - using defaults

Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed.

Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed.
TMainIDE.DoNewProject A
TMainIDE.DoNewEditorFile A NewFilename=
TPascalParserTool.BuildTree B OnlyIntf=FALSE project1.lpr

Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed.
[TCustomFormEditor.CreateComponent] Class='TFORM'
TPascalParserTool.BuildTree B OnlyIntf=FALSE project1.lpr

Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed.

Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed.
TMainIDE.DoNewEditorFile end unit1.pas
TMainIDE.DoNewProject end 0
TApplication.HandleException Access violation
TApplication.HideAllFormsWithStayOnTop :TSPLASHFORM

Gtk-CRITICAL **: file gtkwidget.c: line 3398 (gtk_widget_set_style): assertion `style != NULL' failed.
TApplication.HandleException: there was another exception during showing the first exception
TApplication.HandleException: there was another exception during showing the first exception
[TMainIDE.Destroy] A
lazarus.pp - unhandled exception
[FORMS.PP] ExceptionOccurred

Any idea what's up ?
The system is slackware 9.1

"The reason Santa is so jolly is because he knows where all the bad girls live." A.J. Venter DireqLearn Tech Guru www.direqlearn.org www.silentcoder.cjb.net (personal site)

Reply by email

Vincent Snijders
Show quoted text 14 lines
-----Oorspronkelijk bericht----- Van: Micha Nelissen Verzonden: maandag 15 december 2003 23:00 Vincent Snijders wrote: > Attached patch enables storing objects in a listbox or checklistbox. > The problems I predicted with the implementation came true. In some > applications the destructor of the list called first and after that > the LCL destroys the handle, sometimes it is the other way around. I > think I have captured both cases in the patch. Good work there, the patch looks good.

Well, I have to look into this again, because the patch is not good enough. Lazarus still leaks a bit of memory when the debugger options dialog is used. (Tested both windows 98 and windows 2000). Further research to find out why, is needed. I will do before the end of the week.

I added a check for nil result.

I thought a nil result wouldn't happen, but I forgot to test adding just strings (without objects) to the listbox.

Vincent.

Reply by email

Marc Weustink
to Vincent Snijders: I am not using every part of the IDE, but I always compile lazarus with heaptrc enabled.…

+ From: Vincent Snijders
+ Sent: woensdag 17 december 2003 13:33
+
+ As I said, I can't reproduce them, so I can't locate and fix them. The
+ debug options dialog memory leak is reproducable and will be fixed.

Probalbly because the DebugOptionsDialog is the only place (AFAIK) where a checklistbox is used. I introduced the checklistbox to build the dialog :)

Marc

Reply by email

Marc Weustink
to Mattias Gaertner: On Thu, 18 Dec 2003 10:55:59 +0200 "A.J. Venter" This is a Xlib warning. Do you get this…

+ From: Mattias Gaertner
+ Sent: donderdag 18 december 2003 15:57
+ To:
+ Subject: Re: [lazarus] Wierd crash
+
+
+ On Thu, 18 Dec 2003 10:55:59 +0200 "A.J. Venter" +
+ wrote:
+
+ > New CVS checkout this morning, compiled fine but when I try to run it:
+ >
+ >
+ > Gdk-WARNING **: locale not supported by Xlib, locale set to C +
+ This is a Xlib warning. Do you get this with any other program?

You get this one if your LANG env var isn't set correctly.

Marc

Reply by email

A.J. Venter
to Marc Weustink

I have already found the problem there, seems that I had accidentally deleted some files under /usr/X11R6/lib/X11/locale

I restored those, and this message no longer comes up.

Everything else however still crashes just like before.

I have used Lazarus on Slackware before and I have no idea what's wrong this time.

I should also mention that the make process failed to find the GTK or X units, until I copied it into the source tree, ppc386 on plain pascal programs however has no problem finding all units.

For the record my
echo $LANG
gives C
Since AF does not do much yet, I don't much bother with it.

Ciao
A.J.

Marc Weustink wrote 26 lines
+ From: Mattias Gaertner + Sent: donderdag 18 december 2003 15:57 + To: + Subject: Re: [lazarus] Wierd crash + + + On Thu, 18 Dec 2003 10:55:59 +0200 "A.J. Venter" + + wrote: + + > New CVS checkout this morning, compiled fine but when I try to run it: + > + > + > Gdk-WARNING **: locale not supported by Xlib, locale set to C + + This is a Xlib warning. Do you get this with any other program? You get this one if your LANG env var isn't set correctly. Marc _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
"The reason Santa is so jolly is because he knows where all the bad girls live." A.J. Venter DireqLearn Tech Guru www.direqlearn.org www.silentcoder.cjb.net (personal site)

Reply by email