Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog background color
#1
how do i set the background color for a dialog ?
currently i use a bitmap ...

edit:
i am sitting in an internet cafe, so no chance to test.

// lets set red background and green text for our dialogs
SetDialogBkColor(RGB(255, 0, 0), RGB(0, 255, 0));


thanks
pi
#2
Create brush and return its handle on WM_CTLCOLORDLG. Two lines.

Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

GdiObject- brush=CreateSolidBrush(ColorFromRGB(240 240 100)) ;;add this
if(!ShowDialog("Dialog32" &Dialog32)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2020006 "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam) ;;*
,ret 1 ;;*
,case WM_DESTROY DT_DeleteData(hDlg) ;;*
,case WM_COMMAND goto messages2
,case WM_CTLCOLORDLG ret brush ;;and this
ret
;messages2
sel wParam
,case IDOK
,DT_Ok hDlg ;;*
,case IDCANCEL DT_Cancel hDlg ;;*
ret 1

;* - not necessary in QM >= 2.1.9
#3
This is really great. But how do you set the color for the background of the items in the dialog box, for example a Select List or Group title.
#4
Use one of these messages depending on control type:

WM_CTLCOLOREDIT
WM_CTLCOLORLISTBOX
WM_CTLCOLORBTN
WM_CTLCOLORSCROLLBAR
WM_CTLCOLORSTATIC

lParam is control handle. If you need id, use function GetDlgCtrlID.
#5
Hello i have a list box in my dialog and i used WM_CTLCOLORLISTBOX to put colour in but is there away to add color to the background of the text in the listbox because under the words its still white...
Thanks...
#6
Under case WM_CTLCOLOR..., use

Code:
Copy      Help
SetBkMode wParam 1

It sets texts drawing mode to transparent. To change text color, use

Code:
Copy      Help
SetTextColor wParam 0xff0000

Here 0xff0000 is blue color.

Also look at this:
Dialog fonts
#7
Thanks for your help Gintara but i can't work out how to do it i'm kinda new at doing this sort of thing here is my code i have so far can u show me how to make the background behind text same as (ColorFromRGB(216 250 250)).just when and if u have time..

Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

GdiObject- brush=CreateSolidBrush(ColorFromRGB(167 246 2))
GdiObject- red=CreateSolidBrush(ColorFromRGB(216 250 250))

str controls = "3 5"
str cb3 si5
cb3="XTRA[]QUICKMACROS[]T.A.B"
si5="&Games.ico"
if(!ShowDialog("Web_Pages" &Web_Pages &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 87 65 "WEB"
;2 Button 0x54030000 0x4 30 50 30 12 "Cancel"
;3 ComboBox 0x54230243 0x0 4 10 80 213 ""
;5 Static 0x54000003 0x0 34 24 26 24 ""
;4 Button 0x54020007 0x0 2 2 84 62 "WEB PAGES"
;END DIALOG
;DIALOG EDITOR: "" 0x2010901 "" ""


ret
;messages
mov 816 444 hDlg
sel message

,case WM_INITDIALOG
,case WM_COMMAND goto messages2
,case WM_CTLCOLORDLG ret brush
,case WM_CTLCOLORSTATIC ret brush
,case WM_CTLCOLORLISTBOX ret red
,
ret
;messages2
sel wParam
,case CBN_SELENDOK<<16|3
,_i=CB_SelectedItem(lParam)
,sel _i
,,case 0 web "http://nz.yahoo.com/" 0
,,case 1 web "www.quickmacros.com/forum" 0
,,case 2 web "www.tab.co.nz/racing/" 0

,case IDOK
ret 1


[/code]
#8
,case WM_CTLCOLORLISTBOX ret red

->

,case WM_CTLCOLORLISTBOX
,SetBkMode wParam 1
,ret red
#9
Thanks for taking the time to help Gintara i have it working now..Looks good :-)
#10
can you post a pick of your new dialog?
A new blog on QM coding and automation.

The Macro Hook
#11
I'm new to this kinda stuff and just playing around and trying to learn a bit, QM is a neat lil program.....not sure why u want to see a pic but here it is :-)...


Attached Files Image(s)
   
#12
nice!
A new blog on QM coding and automation.

The Macro Hook
#13
Hello is it possible to make the background of a dialog transparent like in a toolbar???
#14
Yes, use function Transparent.
#15
copy code and name the function trans_dialog

Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
GdiObject- brush=CreateSolidBrush(ColorFromRGB(225 234 247))
GdiObject- bluebrush=CreateSolidBrush(0xff0000)

if(hDlg) goto messages
if(!ShowDialog("trans_dialog" &trans_dialog)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 407 241 "Dialog with a hole :)"
;5 Static 0x54000000 0x0 32 42 320 154 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2020008 "" "0 "


ret
;messages
sel message
,case WM_INITDIALOG
,,Transparent(hDlg 255 0xff0000)
,case WM_COMMAND goto messages2
,case WM_CTLCOLORSTATIC
,,sel GetDlgCtrlID(lParam)
,,,case 5
,,,,ret bluebrush
,case WM_CTLCOLORDLG
,,,ret brush
,case WM_DESTROY
ret
;messages2
sel wParam
,case IDCANCEL
ret 1
pi
#16
Hello could someone help me with a password field for a web page... i have a dialog with a dropdown list with different webpages and one of the web pages need to have name and password entered could someone tell me how i would set it up so when the person first uses the dialog they can set the name and password for that webpage so the next time they use dialog they don't have to set password..hope i have explained what i want ok..
Thanks
#17
If he enters the password in the web page, QM cannot know it. If he enters the password in the dialog, use AutoPassword to transfer it to the web page, and use rset/rget to save and retrieve saved. Also encrypt/decrypt it for security.


Forum Jump:


Users browsing this thread: 1 Guest(s)