Hello All,
Are we able to set color for buttons in dialog?
Thanks
Set color for Button
Moderators: Dorian (MJT support), JRL
- Grovkillen
- Automation Wizard
- Posts: 1024
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Set color for Button
Yes I use that all the time. You can do it manually in the dialog editor or by invoking the dialog property commands.
Re: Set color for Button
I tried to find where to set the color for it manually but I couldn't find it though. I could change Font size, color...
but I want to change the color for buttons.
Also tried the setdialogobjectcolor for MSbutton and it did not work![Sad :(](./images/smilies/icon_sad.gif)
Please show me how to do that
but I want to change the color for buttons.
Also tried the setdialogobjectcolor for MSbutton and it did not work
![Sad :(](./images/smilies/icon_sad.gif)
Please show me how to do that
- Grovkillen
- Automation Wizard
- Posts: 1024
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Set color for Button
Sorry, I use images to fake buttons.... I see that now.
- Grovkillen
- Automation Wizard
- Posts: 1024
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Set color for Button
But better might be to use the awesome HTML element instead and change colors with HTML.
Re: Set color for Button
Microsoft for some unknown reason did not give buttons color flexibility. However, panels are a lot like buttons and they can change colors. Here's a way to use a panel as a button.
HighLight and UnHighLight are not technically needed to be able to execute the panel like a button, but I think they add to the user experience.
Edit:09/16/2020 Added TabStop = True to the Panel1 object properties so that tabbing will go there.
HighLight and UnHighLight are not technically needed to be able to execute the panel like a button, but I think they add to the user experience.
Edit:09/16/2020 Added TabStop = True to the Panel1 object properties so that tabbing will go there.
Code: Select all
Dialog>Dialog1
object Dialog1: TForm
Caption = 'Demo'
ClientHeight = 135
ClientWidth = 210
object Label1: TLabel
Left = 48
Top = 56
Width = 109
Height = 13
Caption = 'Panel Button with color'
end
object Panel1: TPanel
Left = 59
Top = 86
Width = 86
Height = 27
Caption = 'Ok'
Color = 4227327
ParentBackground = False
TabStop = True
end
end
EndDialog>Dialog1
AddDialogHandler>Dialog1,Panel1,OnMouseEnter,HighLight
AddDialogHandler>Dialog1,Panel1,OnMouseLeave,UnHighLight
AddDialogHandler>Dialog1,Panel1,OnClick,Msg
Show>Dialog1,
SRT>Msg
MDL>Button Clicked
END>Msg
SRT>HighLight
SetDialogProperty>Dialog1,Panel1,Color,4227300
END>HighLight
SRT>UnHighLight
SetDialogProperty>Dialog1,Panel1,Color,4227327
END>UnHighLight
Re: Set color for Button
Great! That is what I wanted.JRL wrote: ↑Sat Jul 18, 2020 4:10 pmMicrosoft for some unknown reason did not give buttons color flexibility. However, panels are a lot like buttons and they can change colors. Here's a way to use a panel as a button.
HighLight and UnHighLight are not technically needed to be able to execute the panel like a button, but I think they add to the user experience.
Code: Select all
Dialog>Dialog1 object Dialog1: TForm Caption = 'Demo' ClientHeight = 135 ClientWidth = 210 object Label1: TLabel Left = 48 Top = 56 Width = 109 Height = 13 Caption = 'Panel Button with color' end object Panel1: TPanel Left = 59 Top = 86 Width = 86 Height = 27 Caption = 'Ok' Color = 4227327 ParentBackground = False end end EndDialog>Dialog1 AddDialogHandler>Dialog1,Panel1,OnMouseEnter,HighLight AddDialogHandler>Dialog1,Panel1,OnMouseLeave,UnHighLight AddDialogHandler>Dialog1,Panel1,OnClick,Msg Show>Dialog1, SRT>Msg MDL>Button Clicked END>Msg SRT>HighLight SetDialogProperty>Dialog1,Panel1,Color,4227300 END>HighLight SRT>UnHighLight SetDialogProperty>Dialog1,Panel1,Color,4227327 END>UnHighLight
Thanks a lot for your help.
- Phil Pendlebury
- Automation Wizard
- Posts: 538
- Joined: Tue Jan 16, 2007 9:00 am
- Contact: