Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Text in multiline edit with background color not properly refreshing
#1
I have an multiline inputfield with an yellow background and colored text.
When entering text, the multiline inputfield isn't correctly refreshed/updated (at least that's what I think is happening).
I had it correctly in the past but can not find it anymore, I think I did it through:  "InvalidateRect" in case EN_CHANGE<<16|3 (see code below)
But is this the correct way?


Function notes_yellow_background
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;3 Edit 0x54221044 0x200 20 25 176 64 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2040A00 "*" "" "" ""

str controls = "3"
str e3="TEST123"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
__GdiHandle- t_hbrush
sel message
,case WM_INITDIALOG
,,int- backcolor=0x00ffff
,,int- textcolor=0x0000ff
,,t_hbrush=CreateSolidBrush(backcolor)
,,__Font- f.Create("Courier New" 14 0)
,,f.SetDialogFont(hDlg "3")
,,
,case WM_DESTROY
,,t_hbrush.Delete
,case WM_COMMAND goto messages2
,case WM_CTLCOLOREDIT        
,,if(lParam=id(3 hDlg))
,,,SetBkMode wParam TRANSPARENT
,,,SetTextColor wParam textcolor
,,,SetBkColor wParam backcolor
,,,ret t_hbrush
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,
,case EN_CHANGE<<16|3 ;; This works, but is this correct?
,,InvalidateRect id(3 hDlg) 0 0
ret 1
#2
remove SetBkMode wParam TRANSPARENT
 also don't need 

case EN_CHANGE<<16|3 ;; This works, but is this correct?
,,InvalidateRect id(3 hDlg) 0 0

this is all you need
Code:
Copy      Help
,case WM_CTLCOLOREDIT
,if(lParam=id(3 hDlg))
,,SetTextColor wParam textcolor
,,SetBkColor wParam backcolor
,,ret t_hbrush
#3
Thanks!


Forum Jump:


Users browsing this thread: 1 Guest(s)