Dialog background color

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Dialog background color

Post by kpassaur » Fri Nov 14, 2008 11:47 am

I know I can now change fonts and the color of a font in a dialog. Is there any way the backround color can be set? I saw on another post you can set the default in Windows but that applies to all. Currently I load a white bmp image; however, because the macro has to load a huge image it takes longer to load the entire script.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Nov 14, 2008 5:19 pm

I use a font color for background color in dialogs. There might be a Windows API function to do this but I haven't looked since this is so easy to use. Be sure to read the remarks.

Code: Select all

Dialog>Dialog1
   Caption=Back Ground Color
   Width=265
   Height=132
   Top=286
   Left=238
   Max=1
   Min=1
   Close=1
   //Need to set resize to Zero to prevent scroll bars
   Resize=0
   //Need to make the following label the first object in
   //the dialog so that all other objects are on top of it.
   Label=g,0,0
   Button=Ok,88,64,75,25,3
   Edit=msEdit1,8,24,241,
   //Need to make labels transparent
   Label=Enter your info,88,8,True
EndDialog>Dialog1

//Set Text Color (color number 234567 is a shade of green)
//The letter "g" in webdings is a filled box.  Nice for doing
//background colors in dialogs. The size can be controlled by
//the font size.  4095 is probably the largest number possible
//when using the standard Windows Webdings font.
  SetDialogObjectFont>Dialog1,msLabel1,WebDings,4095,1,234567

show>dialog1,res1

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Dialog Background Color

Post by kpassaur » Fri Nov 14, 2008 6:32 pm

Works like a charm and very easy. Do you have a color reference or where I could get one? I really only want white (I have limited taste)

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Nov 14, 2008 7:05 pm

This post has a color picker program that will put the selected color number to the clipboard. You can then paste it into your script.

Python Color Chooser

Code: Select all

/*
Color:
import tkinter
from tkinter import colorchooser
parent = tkinter.Tk()
parent.withdraw()

color = colorchooser.askcolor(initialcolor=(255, 255, 255), parent=parent)
print(color)
*/

LabelToVar>Color,pCode
PYExec>PCode,vColor

MDL>vColor

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts