Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find and highlight text in other app using regular expresion
#39
Maybe I did something wrong or understood something wrong but I can get the colors to reset back to it's default in a QM richedit control. See below example:

As an alternative, is there a way to so set the full background color (highlighted text and rich-edit-field background) back to white?

Function re_highlight
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 RichEdit20A 0x54233044 0x200 0 26 223 109 ""
;4 Button 0x54032000 0x0 1 5 48 14 "find"
;5 Button 0x54032000 0x4 55 5 98 14 "reset colors"
;END DIALOG
;DIALOG EDITOR: "" 0x2040601 "*" "" "" ""

str controls = "3"
str re3
re3=
;{\rtf1\ansi\ansicpg1252\deff0\deflang1043{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
;{\colortbl ;\red255\green0\blue0;}
;\viewkind4\uc1\pard\cf1\lang1033\b\f0\fs17 1234567\cf0\lang1043\b0\par
;\viewkind4\uc1\pard\cf1\lang1033\b\f0\fs17 123\cf0\lang1043\b0\par
;}
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 4    
,,str rx="\b123\b"        
,,int n=RichEditHighlight(id(3 hDlg) rx 1|4|128 ColorFromRGB(255 255 128) ColorFromRGB(255 0 0))
,,;; When using the below commented code and the below case 5 green commented 'n=RichEditHighlight' it only set's the background color to black
,,;; int n=RichEditHighlight(id(3 hDlg) rx 1|4|128 ColorFromRGB(255 255 128))
,case 5
,,;; This code set's background AND text to black of the selected text
,
,,rx="\b123\b"
,,n=RichEditHighlight(id(3 hDlg) rx 1|4|128 -1 -1)
,,;; When using the below commented code and the above case 4 green commented 'n=RichEditHighlight' it only set's the background color to black
,,;; n=RichEditHighlight(id(3 hDlg) rx 1|4|128 -1)
ret 1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)