- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I want to display text in a text box in Red if it is over a certain value, otherwise display it in Black.
My text box is disabled (i.e. display only).
Searching the forum I found the suggestion of using SetTextColor.
Is this correct, and how would I use it.
Below is an example - but doesn't work. Thanks
write (C11,'(F10.3,A)') d,char(0)
cr=SetTextColor(hDC,RGB(0,256,255))
iret=SetDlgItemText(hwnd,IDC_HEIGHTD,c11)
- Balises:
- Intel® Fortran Compiler
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You can create a "text box" in different ways. From your example, it looks like you want a true "windows" text box of the form that woks in a windows dialog box. A second way is to do all the programming yourself, within the Fortran program. Using Quickwin, this second method is pretty easy. That would involve the Fortran call SetTextColor, which effects the text color within a "text window" which is another Quickwin concept.I do this quite often.
But if you want a true Windows dialog text box--well, I hope there is someone else here that can help. I suspect that SetTextColor is incompatible with the windows dialog process.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Try topic http://software.intel.com/en-us/forums/topic/301886 there are various others on the forum if you search.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thanks, I do want a true Windows dialog text box.
I had found that topic previously when searching - but it makes me realise that my knowledge is limited. I've never (to my knowledge) done subclassing before and not sure where the example code fits into my code.
I have:
iret = DialogBox(hInst,MAKEINTRESOURCE(IDD_MEAN2PTS),hWndMain,LOC(Mean2PtsProc))
which calls:
integer*4 function Mean2PtsProc(hwnd, message, wParam, lParam)
then there is:
select case (message)
case (WM_HELP)
call help
case (WM_INITDIALOG)
Mean2PtsProc=1
h_Write=GetDlgItem(hWnd,IDC_WRITE)
return
case (WM_SHOWWINDOW)
etc...
I'm not sure when hOldProc=SetWindowLong(dlg%hWnd, GWL_WNDPROC, LOC(ColorDlgProc)
fits in with my code.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I solved the problem using Anthony Richard's example. It gives black text on a red background.
I hope to be able to modify it to give red text on a white background - I don't know if that is possible.
http://software.intel.com/en-us/articles/how-to-customize-dialog-box-colors-using-subclassing/
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
As the joint author (with Steve Lionel) I note that the figures included in the article annoyingly fail to display when browsing the article using FireFox.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Nor does it show in Exploder 11 or Chrome.
Neels
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hmm - let me see if I can fix that.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Ok - should be fixed now. I also changed the link for Xeffort to point to the new site.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Figure 1 shows but not figure 2.
Neels
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Weird - it was showing for me earlier. I'll fix it on Monday, but that particular image is not all that useful.

- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable