Lazarus

Programming => LCL => Topic started by: bpranoto on February 08, 2016, 04:36:53 pm

Title: TDBEdit with button
Post by: bpranoto on February 08, 2016, 04:36:53 pm
Is there a DBEdit component with a button?

Pressing the button triggers an event which can be anything up to the programmer like displaying Customer list to choose, a calendar, anything.

I have searched this forum and found http://forum.lazarus.freepascal.org/index.php/topic,26813.msg166397.html#msg166397. The description of the proposed TDBEditButton is exactly what I need. Unfortunately, I can't find it at the Rx packages downloaded from the svn

Thanks.
Title: Re: TDBEdit with button
Post by: balazsszekely on February 08, 2016, 04:48:19 pm
Did you mean TDBEdit with an ellipsis button? If I remember correctly IBObjects supports this feature, but it shouldn't be to difficult to implement. Create a new component(TPanel + TDBEdit + TButton), then implement then appropriate events.
Title: Re: TDBEdit with button
Post by: LacaK on February 08, 2016, 06:01:14 pm
There is already TEditButton in EditBtn unit.
So what we need is data-aware TEditButton (TDBEditButton which should be added into DBExtCtrls)
It does not exists ATM, but it is not so big problem to create them.
Title: Re: TDBEdit with button
Post by: bpranoto on February 09, 2016, 11:05:10 am
Okay, thanks.
Title: Re: TDBEdit with button
Post by: bpranoto on February 11, 2016, 07:32:58 am
Thanks to GetMem, I wrote the component: TF1DBEditButton.

It is a combination of a Panel, DBEdit , and BitBtn. The important properties are:

1. OnButtonClick event: do what ever you like when the user click the button
2. Glyph: to set the button glyph
3. ButtonWidth: width of the button

Files attached are the component package and a small demo project.



Title: Re: TDBEdit with button
Post by: balazsszekely on February 11, 2016, 08:42:55 am
@bpranoto
Thanks for sharing your work!  I'm sure many people will find it useful. Did you test it under the following widgetsets: win32/win64/gt2/qt/carbon?
Title: Re: TDBEdit with button
Post by: bpranoto on February 11, 2016, 09:06:36 am
not yet, I currently only use qt under linux.

This simple component still needs improvements, for instance I just add DirectInput:Boolean property which can prevent the user to modify the the text content directly.

Thanks for your pointer for combining the 3 components.
Title: Re: TDBEdit with button
Post by: balazsszekely on February 11, 2016, 09:15:59 am
Quote
This simple component still needs improvements, for instance I just add DirectInput:Boolean property which can prevent the user to modify the the text content directly.
Feel free to improve it. I can test it later under win32/win64/gtk2/carbon.

Quote
Thanks for your pointer for combining the 3 components.
You're welcome!
Title: Re: TDBEdit with button
Post by: bpranoto on February 11, 2016, 11:05:10 am
Here is a new revision with new properties:

DirectInput:Boolean, if false user cannot modify the text directly
ButtonShortcut: TShortCut, enabling to invoke the button without mouse. Useful for keyboard savvy users.
Title: Re: TDBEdit with button
Post by: jraviles on October 11, 2018, 02:51:21 pm
Thanks a lot for the component, my friend, it was a brilliant idea, I incorporated it into the components I use, adding the ability to change the colors of the background and text as I enter and exit the focus, I added them to my repository:  https://bitbucket.org/redid_software/componentespub/src/master/


Thank you very much
Title: Re: TDBEdit with button
Post by: bpranoto on May 26, 2019, 02:20:43 pm
Thanks a lot for the component, my friend, it was a brilliant idea, I incorporated it into the components I use, adding the ability to change the colors of the background and text as I enter and exit the focus, I added them to my repository:  https://bitbucket.org/redid_software/componentespub/src/master/


Thank you very much

You're welcome!
TinyPortal © 2005-2018