Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Important Update: Community Platform Migration​. Learn more​>
29648 Discussions

How to change colors within Dialog based application.

Intel_C_Intel
Employee
1,813 Views
I am working on Dialog based application. How can I change the background and text colors within EditBox. Unfortunately I can?t use modul Xflogm created by Jugoslav because I need e.g. Dlg_changesize too. Could somebody send me the short strip of the code?
Thanks a lot, Lada.
0 Kudos
2 Replies
Jugoslav_Dujic
Valued Contributor II
1,813 Views
You mean DLG_SIZECHANGE? I totally missed that one. I could add it to XFLOGM, but you'll have to wait for it for a couple of days.

Other than that, your only option is to subclass the dialog and handle WM_CTLCOLOREDIT yourself (this message is sent when an edit controls "asks" the dialog what colors to use). MenuDialog sample on my home page shows how to subclass the dialog (albeit for a different purpose). The subclassing code should be along these lines (written ad-hoc; check out the WM_CTLCOLOR* handling in XFLOGM for comparison -- it's slightly more complicated, as it may call DefWindowProc to retrieve default colors if user-defined are absent):
integer, save:: hBrush =0
...
case(WM_CTLCOLOREDIT)
   if (hBrush == 0) &
      hBrush = CreateSolidBrush(#00FFFFF) !yellow
   if (lParam == GetDlgItem(hDlg, IDC_YOUREDITBOX)) then
      call SetTextColor(wParam, #FF0000)   !blue
      call SetBkMode(wParam, TRANSPARENT)
      DlgProc = hBrush
   end if
case(WM_DESTROY)
   call DeleteObject(hBrush)
   DlgProc = CallWindowProc(...)
case default
   DlgProc = CallWindowProc(...)
end select
Jugoslav
0 Kudos
Intel_C_Intel
Employee
1,813 Views
Thanks you, Jugoslav for your reply. Of course, I thought DLG_SIZECHANGE, excuse me for this mistake. I looked through your sample MenuDialog and try to use it similarly. It is really not quite easy, Ill be wait for your new version Xflogm too. (You needt be in a hurry it could take couple of weeks I will be patient.)
Lada.
0 Kudos
Reply