Sign in Join

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

Mailing lists / lazarus / 2003-07

Patch: ComboBox issues

16 messages · 6 people ·

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner
to Karl Brandt: I'm sending a patch that adress some combobox issues: -fix positioning in enviroment…
Show quoted text 7 lines
+ From: Karl Brandt + Sent: woensdag 30 juli 2003 6:36 + + I'm sending a patch that adress some combobox issues: + -fix positioning in enviroment options Dlg + in object inspector the problem remains(it looks that the autosize + functions uses the total size of combobox and not only the edit size)

Do you mean the internal edit of a combobox?
What autosize function?

+ -Changes to the Height property are ignored and reading it will + allways return the height of the edit part (determined by the font):

Ok. The gtk-interface is doing the same for scrollbars.

+ just like in Delphi

Who cares what Delphi can _not_ do? ;)

+ -implement DropDownCount + this can't be changed at runtime Why not ?

Good question.

+ to access the property i had to typecast to TComboBox: it should'nt be+ public in TcustomComboBox? (see diff) Why ?

TCustomComboBox is a base class, so optional properties should be protected.

Show quoted text 6 lines
+ -remove SetName method + -disable SetComboMinDropDownSize: it's not necessary, at least until now + + BTW Can i send the patches in rar format? I can handle them both, I don't know if Mattias can handle them.

Where can I get a rar unpacker for linux?

Mattias

Reply by email

Lord Satan
to Karl Brandt: I'm sending a patch that adress some combobox issues: -fix positioning in enviroment…
Show quoted text 53 lines
On Wed, 30 Jul 2003 11:10:57 +0200 "Marc Weustink" wrote: > + From: Karl Brandt > + Sent: woensdag 30 juli 2003 6:36 > + > + I'm sending a patch that adress some combobox issues: > + -fix positioning in enviroment options Dlg > + in object inspector the problem remains(it looks that the autosize > + functions uses the total size of combobox and not only the edit size) Do you mean the internal edit of a combobox? What autosize function? > + -Changes to the Height property are ignored and reading it will > + allways return the height of the edit part (determined by the font): Ok. The gtk-interface is doing the same for scrollbars. > + just like in Delphi Who cares what Delphi can _not_ do? ;) > + -implement DropDownCount > + this can't be changed at runtime > > Why not ? Good question. > + to access the property i had to typecast to TComboBox: it should'nt > be+ public in TcustomComboBox? (see diff) > > Why ? TCustomComboBox is a base class, so optional properties should be protected. > + -remove SetName method > + -disable SetComboMinDropDownSize: it's not necessary, at least until now > + > + BTW Can i send the patches in rar format? > > I can handle them both, I don't know if Mattias can handle them. Where can I get a rar unpacker for linux?

You may want to try apt-get install unrar and get it from freshrpms.net

Reply by email

Marco van de Voort
to Mattias Gaertner: On Wed, 30 Jul 2003 11:10:57 +0200 Do you mean the internal edit of a combobox? What…
Show quoted text 13 lines
TCustomComboBox is a base class, so optional properties should be protected. > + -remove SetName method > + -disable SetComboMinDropDownSize: it's not necessary, at least until now > + > + BTW Can i send the patches in rar format? > > I can handle them both, I don't know if Mattias can handle them. Where can I get a rar unpacker for linux?

IIRC there is a binary pack/unpacker for linux, and a unpacker only in source form. (which is used by FreeBSD).

The unpacker src is at http://files10.rarlab.com/rar/unrarsrc-3.2.2.tar.gz

Reply by email

Marc Weustink
to Karl Brandt: I'm sending a patch that adress some combobox issues: -fix positioning in enviroment…

+ From: Karl Brandt
+ Sent: woensdag 30 juli 2003 6:36
+
+ I'm sending a patch that adress some combobox issues:
+ -fix positioning in enviroment options Dlg
+ in object inspector the problem remains(it looks that the autosize
+ functions uses the total size of combobox and not only the edit size)
+ -Changes to the Height property are ignored and reading it will
+ allways return the height of the edit part (determined by the font):
+ just like in Delphi
+ -implement DropDownCount
+ this can't be changed at runtime

Why not ?

+ to access the property i had to typecast to TComboBox: it should'nt be
+ public in TcustomComboBox? (see diff)

Why ?

+ -remove SetName method
+ -disable SetComboMinDropDownSize: it's not necessary, at least until now +
+ BTW Can i send the patches in rar format?

I can handle them both, I don't know if Mattias can handle them.

Marc

Reply by email

Michael Van Canneyt
to Marc Weustink: + From: Mattias Gaertner + Sent: woensdag 30 juli 2003 14:11 + + + On Wed, 30 Jul 2003…
Marc Weustink wrote 29 lines
+ From: Mattias Gaertner + Sent: woensdag 30 juli 2003 14:11 + + + On Wed, 30 Jul 2003 11:10:57 +0200 + "Marc Weustink" wrote: + + > + From: Karl Brandt + > + Sent: woensdag 30 juli 2003 6:36 [SNIP] + > + -Changes to the Height property are ignored and reading it will + > + allways return the height of the edit part (determined by the font): + + Ok. The gtk-interface is doing the same for scrollbars. + + + > + just like in Delphi + + Who cares what Delphi can _not_ do? ;) It is not a Delphi issue, but it is (or at least was) a Win(32 ?) issue. For some odd reason, the height of a combo is the Edit area + DropDownHeight. At least that was what I thought. I've reread the the MSDN about comboboxes and nowhere is stated that the height is fixed. I think it is possible to set the heigtht of the edit area.

It depends on the combobox style. Normally it is only so for 'simple' dropdowns. From the Delphi help:

csDropDown Creates a drop-down list with an edit box for manually entered text. All items are strings of the same height.

csSimple Creates an edit box with a fixed list (list box) underneath. The length of the list is determined by the Height of the combo box.

csDropDownList Creates a drop-down list with no edit box; the user cannot enter text manually. All items are strings of the same height.

csOwnerDrawFixed Creates an owner-draw drop-down list with an edit box for manually entered text. Each item in the list is the height specified by the ItemHeight property.

csOwnerDrawVariable Creates an owner-draw drop-down list with an edit box for manually entered text. List items can have varying heights.

Michael.

Reply by email

Karl Brandt

I'm sending a patch that adress some combobox issues: -fix positioning in enviroment options Dlg
in object inspector the problem remains(it looks that the autosize functions uses the total size of combobox and not only the edit size) -Changes to the Height property are ignored and reading it will allways return the height of the edit part (determined by the font): just like in Delphi
-implement DropDownCount
this can't be changed at runtime
to access the property i had to typecast to TComboBox: it should'nt be public in TcustomComboBox? (see diff)
-remove SetName method
-disable SetComboMinDropDownSize: it's not necessary, at least until now

BTW Can i send the patches in rar format?

karl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00018.zip
Type: application/octet-stream
Size: 2113 bytes
Desc: "combo2.zip"
Url : http://localhost/pipermail/lazarus/attachments/20030730/8d3fdef7/zip00018.obj

Reply by email

Marc Weustink
to Mattias Gaertner: On Wed, 30 Jul 2003 11:10:57 +0200 Do you mean the internal edit of a combobox? What…

+ From: Mattias Gaertner
+ Sent: woensdag 30 juli 2003 14:11
+
+
+ On Wed, 30 Jul 2003 11:10:57 +0200
+ "Marc Weustink" wrote:
+
+ > + From: Karl Brandt
+ > + Sent: woensdag 30 juli 2003 6:36

[SNIP]

+ > + -Changes to the Height property are ignored and reading it will
+ > + allways return the height of the edit part (determined by the font): +
+ Ok. The gtk-interface is doing the same for scrollbars. +
+
+ > + just like in Delphi
+
+ Who cares what Delphi can _not_ do? ;)

It is not a Delphi issue, but it is (or at least was) a Win(32 ?) issue.

For some odd reason, the height of a combo is the Edit area + DropDownHeight.
At least that was what I thought. I've reread the the MSDN about comboboxes and nowhere is stated that the height is fixed. I think it is possible to set the heigtht of the edit area.

Speaking of, I've been playing with it in the past and the only issue which comes into mind is that when the edit area height is less then the internal editor height, the editor is not shown. I cant recall if it was on all platforms or just win311/win95/NT351/NT4

Marc

Reply by email

Karl Brandt
to Michael Van Canneyt: It depends on the combobox style. Normally it is only so for 'simple' dropdowns. From the…
Michael Van Canneyt wrote 6 lines
csSimple Creates an edit box with a fixed list (list box) underneath. The length of the list is determined by the Height of the combo box.

At least in win32, the height is equal = Edit height + List height; Try to create a control(CBS_SIMPLE) with size = 48. It will create a edit (24 pixels sizes) + a list(24 pixels sizes)

karl

Reply by email

Marc Weustink
to Karl Brandt: Win32 docs call it Selection field or Edit control which is the part you see when is not…

+ From: Karl Brandt
+ Sent: donderdag 31 juli 2003 4:22
+
+ Mattias Gaertner wrote:
+
+ > On Wed, 30 Jul 2003 11:10:57 +0200
+ > "Marc Weustink" wrote:
+ >

[Snip]

+ > What autosize function?
+
+ I think has to do with setting Align property to alTop in
+ TObjectInspector.AvailCompsComboBox.
+ I can't see other positioning setting in this control. +
+ It looks, at same time after a WM_SIZE, that the LCL stores the total
+ height (Edit + dropDownlist) as the actual clientrect and uses this when
+ positioning the controls.
+ If i modify the WM_SIZE handling i could avoid this, but i'm looking a
+ cleaner way

I was wondering why there isn't such adjustment in Delphi, so I've been playing with some spy and control modification tools and saw the following.

When sending a SetWindowPos with a new height N (Original height is H) I get:
WM_WINDOWPOSCHANGING height N
WM_WINDOWPOSCHANGED height N
WM_SIZE height N
WM_WINDOWPOSCHANGING height H
WM_WINDOWPOSCHANGED height H
WM_SIZE height H
WM_WINDOWPOSCHANGING height H

So the win32 interface should allways report editheight at the end (but isn't it getting this height from the internal WM_SIZE ?)

On a dropdown I see the same, where N is the total height.

GetClientRect reports height N

[SNIP]

+ > TCustomComboBox is a base class, so optional properties should
+ > be protected.
+
+ The current way i did is incompatible if custom descendants of
+ TCustomComboBox

I think it also works for fpc. to access protected members, cast it to a local derived class, like
TMyCustomComboBox = class(TCustomComboBox)

  end;

Marc

Reply by email

Karl Brandt
to Marc Weustink
Marc Weustink wrote
I was wondering why there isn't such adjustment in Delphi, so I've been playing with some spy and control modification tools and saw the following.

Can you share these tools?

Show quoted text 10 lines
When sending a SetWindowPos with a new height N (Original height is H) I get: WM_WINDOWPOSCHANGING height N WM_WINDOWPOSCHANGED height N WM_SIZE height N WM_WINDOWPOSCHANGING height H WM_WINDOWPOSCHANGED height H WM_SIZE height H WM_WINDOWPOSCHANGING height H

Did you tested in LCL or in plain win32?

Show quoted text 20 lines
So the win32 interface should allways report editheight at the end (but isn't it getting this height from the internal WM_SIZE ?) On a dropdown I see the same, where N is the total height. GetClientRect reports height N [SNIP] + > TCustomComboBox is a base class, so optional properties should + > be protected. + + The current way i did is incompatible if custom descendants of + TCustomComboBox I think it also works for fpc. to access protected members, cast it to a local derived class, like TMyCustomComboBox = class(TCustomComboBox) end;

Thanks for the hint

karl

Reply by email

Marc Weustink
to Marc Weustink: + From: Karl Brandt + Sent: donderdag 31 juli 2003 4:22 + + + > On Wed, 30 Jul 2003…
Karl Brandt wrote 5 lines
Marc Weustink wrote: >I was wondering why there isn't such adjustment in Delphi, so I've been >playing with some spy and control modification tools and saw the following. Can you share these tools?

No and Yes.
The first I used was part of the MS visualstudio tools: SpyXX.exe this one is better than winsight (ws32.exe) from borland. I don't know if SpyXX is freely available.
The second was an attempt to create a modification tool myself, I can mail the exe if you want.

Show quoted text 11 lines
>When sending a SetWindowPos with a new height N (Original height is H) I >get: > WM_WINDOWPOSCHANGING height N > WM_WINDOWPOSCHANGED height N > WM_SIZE height N > WM_WINDOWPOSCHANGING height H > WM_WINDOWPOSCHANGED height H > WM_SIZE height H > WM_WINDOWPOSCHANGING height H Did you tested in LCL or in plain win32?

This was running an D6 exe with a combobox. I haven't tried a plain native win32 combo (don't want to create the example myself)

Marc

Reply by email

Karl Brandt
to Marc Weustink: + From: Mattias Gaertner + Sent: woensdag 30 juli 2003 14:11 + + + On Wed, 30 Jul 2003…
Marc Weustink wrote 17 lines
+ > + -Changes to the Height property are ignored and reading it will + > + allways return the height of the edit part (determined by the font): + + Ok. The gtk-interface is doing the same for scrollbars. + + + > + just like in Delphi + + Who cares what Delphi can _not_ do? ;) It is not a Delphi issue, but it is (or at least was) a Win(32 ?) issue. For some odd reason, the height of a combo is the Edit area + DropDownHeight. At least that was what I thought. I've reread the the MSDN about comboboxes and nowhere is stated that the height is fixed. I think it is possible to set the heigtht of the edit area.

You can set in two ways:
-Sending a CB_SETITEMHEIGHT message, but just after a click the size returns to the former. I think this is useful only with owner draw controls

-Changing the control font: default font: size = 24, default GUI font = 21

and AFAIK standalone edits height also can't be changed

Speaking of, I've been playing with it in the past and the only issue which comes into mind is that when the edit area height is less then the internal editor height, the editor is not shown. I cant recall if it was on all platforms or just win311/win95/NT351/NT4

If you set height < (EditHeight+ ItemHeight + 2) the dropdown list is not show.
Where EditHeight = Getwindowrect (and not CB_GETITEMHEIGHT,-1 returned value)
ItemHeight = CB_SETITEMHEIGHT,0

Bellow i'll try to explain the behavior under win32:

height < (EditHeight+ ItemHeight + 2) -> dropdown is not show height > (EditHeight+ ItemHeight + 2)
- without items : shows a empty dropdown list where heigth(of the dropdown) = height - EditHeight -( 2 ??)
- with items
+ ((number of items)*item height + EditHeight) < heigth : fits to the number of items
+ ((number of items)*item height + EditHeight) > heigth : shows a scrollbar (if WS_SCROLL style)

When i said before : i _tried_ ;-)

karl

Reply by email

Karl Brandt
to Karl Brandt: I'm sending a patch that adress some combobox issues: -fix positioning in enviroment…
Mattias Gaertner wrote 14 lines
On Wed, 30 Jul 2003 11:10:57 +0200 "Marc Weustink" wrote: >+ From: Karl Brandt >+ Sent: woensdag 30 juli 2003 6:36 >+ >+ I'm sending a patch that adress some combobox issues: >+ -fix positioning in enviroment options Dlg >+ in object inspector the problem remains(it looks that the autosize >+ functions uses the total size of combobox and not only the edit size) Do you mean the internal edit of a combobox?

Win32 docs call it Selection field or Edit control which is the part you see when is not dropped

What autosize function?

I think has to do with setting Align property to alTop in TObjectInspector.AvailCompsComboBox.
I can't see other positioning setting in this control.

It looks, at same time after a WM_SIZE, that the LCL stores the total height (Edit + dropDownlist) as the actual clientrect and uses this when positioning the controls.
If i modify the WM_SIZE handling i could avoid this, but i'm looking a cleaner way

I didn't get the required time to debugging yet

Show quoted text 25 lines
>+ -Changes to the Height property are ignored and reading it will >+ allways return the height of the edit part (determined by the font): Ok. The gtk-interface is doing the same for scrollbars. >+ just like in Delphi Who cares what Delphi can _not_ do? ;) >+ -implement DropDownCount >+ this can't be changed at runtime > >Why not ? Good question.

See previous email

Show quoted text 9 lines
>+ to access the property i had to typecast to TComboBox: it should'nt >be+ public in TcustomComboBox? (see diff) > >Why ? TCustomComboBox is a base class, so optional properties should be protected.

The current way i did is incompatible if custom descendants of TCustomComboBox

Show quoted text 12 lines
>+ -remove SetName method >+ -disable SetComboMinDropDownSize: it's not necessary, at least until now >+ >+ BTW Can i send the patches in rar format? > >I can handle them both, I don't know if Mattias can handle them. Where can I get a rar unpacker for linux?

Reply by email

Karl Brandt
to Marc Weustink: + From: Karl Brandt + Sent: woensdag 30 juli 2003 6:36 + + I'm sending a patch that…
Marc Weustink wrote 5 lines
+ -implement DropDownCount + this can't be changed at runtime Why not ?

The LCL doesn't notify the interface when changed. See the TCustomComboBox.SetDropDown

+ to access the property i had to typecast to TComboBox: it should'nt be + public in TcustomComboBox? (see diff) Why ?

DropDownCount is a private field in TcustomComboBox

Show quoted text 7 lines
+ -remove SetName method + -disable SetComboMinDropDownSize: it's not necessary, at least until now + + BTW Can i send the patches in rar format? I can handle them both, I don't know if Mattias can handle them.
Sorry about the misunderstanding. I was lazy when i wrote the email :-;

karl

Reply by email