08-28-2020, 01:50 PM
I noticed when using "DT_SetTextColor" the dialog is refreshed completely thus giving that short redraw effect (at least in my dialog).
My dialog is a folder browser using a listbox, certain filetypes get colored differently (rtf = purple, txt=black, doc=blue ,....)
The problem is that every time a file-item is clicked within the listbox the whole dialog refreshes (you can see the dialog refresh itself, it's very fast but still noticeable)
I cloned the items within "DT_SetTextColor" and then disabled the last line:
if(IsWindowVisible(hDlg)) InvalidateRect hDlg 0 1
And then it all worked without the refresh effect.
But for now I wanted know how to use "SetTextColor and SetBkMode" in the below example.
Using "SetTextColor and SetBkMode" I could then decide how to do the refresh if it's still needed.
Probably this should work also then: RedrawWindow(###CONTROL_ID### 0 0 RDW_INVALIDATE)
What I have below doesn't work but any example of how to do it is greatly appreciated.
(I have a way of doing this with the background color, there are examples of that ,but I can't get the textcolor method working...)
(The editfield and static needs to change color on buttonpress.)
Function change_txt_color_on_buttonpress
My dialog is a folder browser using a listbox, certain filetypes get colored differently (rtf = purple, txt=black, doc=blue ,....)
The problem is that every time a file-item is clicked within the listbox the whole dialog refreshes (you can see the dialog refresh itself, it's very fast but still noticeable)
I cloned the items within "DT_SetTextColor" and then disabled the last line:
if(IsWindowVisible(hDlg)) InvalidateRect hDlg 0 1
And then it all worked without the refresh effect.
But for now I wanted know how to use "SetTextColor and SetBkMode" in the below example.
Using "SetTextColor and SetBkMode" I could then decide how to do the refresh if it's still needed.
Probably this should work also then: RedrawWindow(###CONTROL_ID### 0 0 RDW_INVALIDATE)
What I have below doesn't work but any example of how to do it is greatly appreciated.
(I have a way of doing this with the background color, there are examples of that ,but I can't get the textcolor method working...)
(The editfield and static needs to change color on buttonpress.)
Function change_txt_color_on_buttonpress
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Button 0x54032000 0x0 95 80 48 14 "Button"
;4 Edit 0x54231044 0x200 30 10 152 22 ""
;5 Static 0x54000000 0x0 90 40 48 12 "TEST"
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""
str controls = "4"
str e4="TEST"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret
#sub DlgProc
function# hDlg message wParam lParam
sel message
,case WM_INITDIALOG
,,GdiObject-- brush1=CreateSolidBrush(ColorFromRGB(240 240 100))
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_CTLCOLOREDIT goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3
,;,;;; ?
,,;SetBkMode wParam TRANSPARENT
,,;SetTextColor wParam ColorFromRGB(0 0 255)
,,;ret brush1
ret 1