Recent

Author Topic: any ideas to make buttons "prettier"?  (Read 8720 times)

Blue1987

  • Full Member
  • ***
  • Posts: 165
any ideas to make buttons "prettier"?
« on: September 17, 2011, 04:29:17 pm »
hi guys...
I was thinking to use what learned here
http://www.lazarus.freepascal.org/index.php/topic,14492.msg76769.html#msg76769

to override the paint procedure of the buttons (they are all bitbtn, but I am using them as they were simply tbuttons) I used in the design of the form, in order to make them "prettier"...


I really do not know what I am exactly looking for... maybe something with transparency, or some smooth shape... or shadows... or ... dunno!!!

any idea?

Arbee

  • Full Member
  • ***
  • Posts: 223
1.0/2.6.0  XP SP3 & OS X 10.6.8

Zoran

  • Hero Member
  • *****
  • Posts: 1464
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: any ideas to make buttons "prettier"?
« Reply #2 on: September 17, 2011, 07:12:14 pm »

lainz

  • Guest
Re: any ideas to make buttons "prettier"?
« Reply #3 on: September 17, 2011, 09:57:19 pm »
See testbgracontrols (when you download BGRAControls of course).

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: any ideas to make buttons "prettier"?
« Reply #4 on: September 18, 2011, 04:19:03 pm »
by the way...
Tlabel has "paint" procedure, which is the equivalent procedure for a Tbutton? (or Tbitbtn)??
so that I just override the paint procedure (without substituting all the bitbtns I've already placed in the form)...

lainz

  • Guest
Re: any ideas to make buttons "prettier"?
« Reply #5 on: September 18, 2011, 04:47:21 pm »
by the way...
Tlabel has "paint" procedure, which is the equivalent procedure for a Tbutton? (or Tbitbtn)??
so that I just override the paint procedure (without substituting all the bitbtns I've already placed in the form)...

Right clic on the button > Change class > select TBGRAButton in 'New class' > then click on 'Remove all invalid properties'.

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: any ideas to make buttons "prettier"?
« Reply #6 on: September 18, 2011, 07:36:45 pm »
by the way...
Tlabel has "paint" procedure, which is the equivalent procedure for a Tbutton? (or Tbitbtn)??
so that I just override the paint procedure (without substituting all the bitbtns I've already placed in the form)...

Right clic on the button > Change class > select TBGRAButton in 'New class' > then click on 'Remove all invalid properties'.

ehr, I haven't well explained what I meant. I have thousends bitbtns already in the form, I cannot do it thousands times :)
So I would simply override the "paint" procedure for all Tbitbtn in the form...

CaptBill

  • Sr. Member
  • ****
  • Posts: 435
Re: any ideas to make buttons "prettier"?
« Reply #7 on: September 18, 2011, 08:19:27 pm »
by the way...
Tlabel has "paint" procedure, which is the equivalent procedure for a Tbutton? (or Tbitbtn)??
so that I just override the paint procedure (without substituting all the bitbtns I've already placed in the form)...

Right clic on the button > Change class > select TBGRAButton in 'New class' > then click on 'Remove all invalid properties'.

ehr, I haven't well explained what I meant. I have thousends bitbtns already in the form, I cannot do it thousands times :)
So I would simply override the "paint" procedure for all Tbitbtn in the form...

You only need to change the OnPaint  procedure of your base TButton, assuming you want the same style/paint routine.
Get one button going like you like and just change the class definition of each button in the .lfm to preserve your other properties, is one approach.
Code: [Select]
xButton =TButton // change to  xButton=TMyButton.

« Last Edit: September 18, 2011, 08:21:55 pm by CaptBill »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: any ideas to make buttons "prettier"?
« Reply #8 on: September 18, 2011, 08:44:44 pm »
to override the paint procedure of the buttons (they are all bitbtn,

never override the paint event of tbutton, tbitbtn or in general any lcl standard windowed native control.  this may work in Windows bit will not work in any other platform. Lazarus provides a series of non-native equivalents for standard controls here: wiki.lazarus.freepascal.org/Lazarus_Custom_Drawn_Controls

Blue1987

  • Full Member
  • ***
  • Posts: 165
Re: any ideas to make buttons "prettier"?
« Reply #9 on: September 19, 2011, 08:10:24 pm »
to override the paint procedure of the buttons (they are all bitbtn,

never override the paint event of tbutton, tbitbtn or in general any lcl standard windowed native control.  this may work in Windows bit will not work in any other platform. Lazarus provides a series of non-native equivalents for standard controls here: wiki.lazarus.freepascal.org/Lazarus_Custom_Drawn_Controls

thank you...

btw, how can I say to lazarus (somewhere in the unit1, I guess): "all bitbtn in the form are not tbitbtn anymore but become customdrawn_button"?
or bgra_buttons?

lainz

  • Guest
Re: any ideas to make buttons "prettier"?
« Reply #10 on: September 20, 2011, 03:29:15 am »
to override the paint procedure of the buttons (they are all bitbtn,

never override the paint event of tbutton, tbitbtn or in general any lcl standard windowed native control.  this may work in Windows bit will not work in any other platform. Lazarus provides a series of non-native equivalents for standard controls here: wiki.lazarus.freepascal.org/Lazarus_Custom_Drawn_Controls

thank you...

btw, how can I say to lazarus (somewhere in the unit1, I guess): "all bitbtn in the form are not tbitbtn anymore but become customdrawn_button"?
or bgra_buttons?

Try to open the .lfm with a text editor and replace 'TButton' with 'TBGRAButton' or 'TCDButton'.

Depending on the new button properties when you open the form you will need to press the 'remove unused prop..' for each button.

Zoran

  • Hero Member
  • *****
  • Posts: 1464
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: any ideas to make buttons "prettier"?
« Reply #11 on: September 20, 2011, 08:37:51 am »

Try to open the .lfm with a text editor and replace 'TButton' with 'TBGRAButton' or 'TCDButton'.

Depending on the new button properties when you open the form you will need to press the 'remove unused prop..' for each button.

Also, for each .lfm, you must do the same in .pas file.