* * *

Author Topic: TDBEdit with button  (Read 3065 times)

bpranoto

  • New member
  • *
  • Posts: 9
TDBEdit with button
« 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.

GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: TDBEdit with button
« Reply #1 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.

LacaK

  • Hero Member
  • *****
  • Posts: 564
Re: TDBEdit with button
« Reply #2 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.

bpranoto

  • New member
  • *
  • Posts: 9
Re: TDBEdit with button
« Reply #3 on: February 09, 2016, 11:05:10 am »
Okay, thanks.

bpranoto

  • New member
  • *
  • Posts: 9
Re: TDBEdit with button
« Reply #4 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.




GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: TDBEdit with button
« Reply #5 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?

bpranoto

  • New member
  • *
  • Posts: 9
Re: TDBEdit with button
« Reply #6 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.

GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: TDBEdit with button
« Reply #7 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!

bpranoto

  • New member
  • *
  • Posts: 9
Re: TDBEdit with button
« Reply #8 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.

jraviles

  • Newbie
  • Posts: 1
Re: TDBEdit with button
« Reply #9 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

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus