Recent

Author Topic: Combobox with no borders?  (Read 1120 times)

Jvan

  • Full Member
  • ***
  • Posts: 121
Combobox with no borders?
« on: September 11, 2020, 11:07:27 pm »
Is it possible?
By default it has "BorderStyle: bsNone", but it still has borders.

Blaazen

  • Hero Member
  • *****
  • Posts: 3011
  • POKE 54296,15
    • Eye-Candy Controls
Re: Combobox with no borders?
« Reply #1 on: September 11, 2020, 11:37:00 pm »
I don't understand why Lazarus has this property published because it seems Delphi doesn't have it.
Lazarus 2.1.0 r64115 FPC 3.3.1 r40507 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

jamie

  • Hero Member
  • *****
  • Posts: 4055
Re: Combobox with no borders?
« Reply #2 on: September 11, 2020, 11:53:20 pm »
Is it possible?
By default it has "BorderStyle: bsNone", but it still has borders.

Combo is a Interface/OS control and is draw mostly via the OS so some of those properties may not do much for you in a Win32 target. could be different elsewhere
The only true wisdom is knowing you know nothing

winni

  • Hero Member
  • *****
  • Posts: 2122
Re: Combobox with no borders?
« Reply #3 on: September 11, 2020, 11:53:59 pm »
Hi!

As the ComboBox is a WinControl this is a decision of the widgetset:

Code: Pascal  [Select][+][-]
  1. procedure TWinControl.SetBorderStyle(NewStyle: TBorderStyle);
  2. begin
  3.   if FBorderStyle = NewStyle then Exit;
  4.   FBorderStyle := NewStyle;
  5.   if HandleAllocated then
  6.     TWSWinControlClass(WidgetSetClass).SetBorderStyle(Self, NewStyle);
  7. end;
  8.  

Winni

jamie

  • Hero Member
  • *****
  • Posts: 4055
Re: Combobox with no borders?
« Reply #4 on: September 12, 2020, 01:34:30 am »
Is it possible?
By default it has "BorderStyle: bsNone", but it still has borders.

Not the best solution because the drop down would also need to be calculated.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.    SetWindowRgn(ComboBox1.Handle, CreateRectRgn(2,2,ComboBox1.Width - 2,
  4.                 ComboBox1.Height - 2), True)
  5. end;                                                                      
  6.  
The only true wisdom is knowing you know nothing

Gald

  • New Member
  • *
  • Posts: 19
Re: Combobox with no borders?
« Reply #5 on: November 28, 2020, 05:40:22 am »
I tried to report it on BugTracker (#38126), this was my first report on Bugtracker ever.  :-[

The dev asked me about Delphi. If Delphi can do it and it does! But with another property name (see related pic).
But seems that he need a new version of Delphi to see how it is coded.

Anyway, It can be done someway. Does anyone know the solution?

lucamar

  • Hero Member
  • *****
  • Posts: 3461
Re: Combobox with no borders?
« Reply #6 on: November 28, 2020, 07:51:54 am »
But seems that he need a new version of Delphi to see how it is coded.

Not, probably, to see how it's coded but to see how it works: what it does, what other properties affect it, etc.

We don't want Embarcadero starting again the old FUD of "look, Lazarus copies our code!", do we? ;D
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.10/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Bart

  • Hero Member
  • *****
  • Posts: 4115
    • Bart en Mariska's Webstek
Re: Combobox with no borders?
« Reply #7 on: November 28, 2020, 01:30:34 pm »
The dev asked me about Delphi. If Delphi can do it and it does! But with another property name (see related pic).

I asked you about Delphi compatibilty, not once, but several times.
You refused to answer my questions there and insist that because Delphi implements a property name BevelEdges, that this would imply that in Lazarus the property BorderStyle should do the same.

I then asked you if something like
Code: Pascal  [Select][+][-]
  1. Combobox1.BorderStyle := bsNone;
would even compile in Delphi.
Again no answer from you.

So please don't lash out at me here.

My basic question was, and still is: does Delphi implement a borderstyle property for TCombobox?

Things I haven't been able to investigate yet: does setting BorderStyle have the expected effect in other widgetsets (GTK2, GTK3, QT4, QT5, Cocoa)?
If not, then a better action would be to not publish this property at all.

Bart

Bart

  • Hero Member
  • *****
  • Posts: 4115
    • Bart en Mariska's Webstek
Re: Combobox with no borders?
« Reply #8 on: November 28, 2020, 01:33:01 pm »
B.t.w. you might be able to achieve this in windows using GetWindowLong/SetWindowLong (query GWL_EXSTYLE and then change it to be borderless).

Warning: untested hypothesis.

Bart

PascalDragon

  • Hero Member
  • *****
  • Posts: 2629
  • Compiler Developer
Re: Combobox with no borders?
« Reply #9 on: November 28, 2020, 03:46:07 pm »
My basic question was, and still is: does Delphi implement a borderstyle property for TCombobox?

Tested with Delphi 10.2: no, it does not.

Bart

  • Hero Member
  • *****
  • Posts: 4115
    • Bart en Mariska's Webstek
Re: Combobox with no borders?
« Reply #10 on: November 28, 2020, 04:58:24 pm »
My basic question was, and still is: does Delphi implement a borderstyle property for TCombobox?

Tested with Delphi 10.2: no, it does not.

Thanks.

Bart

Gald

  • New Member
  • *
  • Posts: 19
Re: Combobox with no borders?
« Reply #11 on: November 28, 2020, 06:44:27 pm »
Solved.  :D

Thank you!

Bart

  • Hero Member
  • *****
  • Posts: 4115
    • Bart en Mariska's Webstek
Re: Combobox with no borders?
« Reply #12 on: November 28, 2020, 11:18:27 pm »
From your screenshot, do I have to infer that setting the font of the form somehow makes the combobox borderless?

How did you achieve a borderless Combobox exactly?

Bart

jamie

  • Hero Member
  • *****
  • Posts: 4055
Re: Combobox with no borders?
« Reply #13 on: November 29, 2020, 07:40:29 pm »
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.    SetWindowRgn(ComboBox1.Handle, CreateRectRgn(2,2,ComboBox1.Width - 2,
  4.                 ComboBox1.Height - 2), True)
  5. end;
  6.  
  7.  
This will remove the border, simply because it can't draw there.

As for the drop down, that can be done by removing the WS_BORDER from the Style property of the window using the SetwindowLong.

of course you need to use the GetComboBoxInfo to obtain the handle to the ListItem..

All of this works if you really want it bad enough.
The only true wisdom is knowing you know nothing

Bart

  • Hero Member
  • *****
  • Posts: 4115
    • Bart en Mariska's Webstek
Re: Combobox with no borders?
« Reply #14 on: December 01, 2020, 11:04:11 pm »
I have resolved the issue in the bugtracker by documenting that this is not supported under Windows.
It will show up in the "Restricted" tab of the Object Inspector.
Some other widgetsets actually seem to support it, so no reason to remove this property.

Googling for "delphi borderless combobox" showed me 2 other possible solutions.
One is to sublclass TComboBox and override Paint.
The other is a combobox replacement by TMS Software (Delphi): https://www.tmssoftware.com/site/advcombo.asp

Bart

 

TinyPortal © 2005-2018