Posts: 262
Threads: 63
Joined: Nov 2005
I am trying to do what was suggested near the bottom of the page in this post.
Magnifier programming?
"can you teach us how to draw an rectangle for selecting an area of interest on screen ?"
If does not have to be on the screen. I would like to be able to select an area on a RTF dialog. Can this be done?
Posts: 12,073
Threads: 140
Joined: Dec 2002
Function
dlg_draw_focus_rect
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str rea3
if(!ShowDialog("dlg_draw_focus_rect" &dlg_draw_focus_rect &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 RichEdit20A 0x54233044 0x200 20 20 96 48 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030006 "*" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
,
,case WM_SETCURSOR
,;if(DragDrawFocusRect(hDlg wParam lParam)) ret DT_Ret(hDlg 1)
,if(DragDrawFocusRect(hDlg wParam lParam 3)) ret DT_Ret(hDlg 1)
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
Function
DragDrawFocusRect
;/
function! hDlg wParam lParam [idCtrl]
;Draws focus rectangle in your dialog.
;Call this function in your dialog function, on WM_SETCURSOR.
;If it returns not 0, execute this code: ret DT_Ret(hDlg 1)
;hDlg, wParam, lParam - hDlg, wParam, lParam.
;idCtrl - id of control in which to draw. If omitted or 0, draws in dialog.
;EXAMPLE
,;case WM_SETCURSOR
,;if(DragDrawFocusRect(hDlg wParam lParam)) ret DT_Ret(hDlg 1)
type DFR_DATA hwnd dc POINT'p RECT'r
DFR_DATA d
if(lParam&0xffff!=HTCLIENT or lParam>>16!=WM_LBUTTONDOWN) ret
d.hwnd=iif(idCtrl id(idCtrl hDlg) hDlg); if(wParam!=d.hwnd) ret
d.dc=GetDC(d.hwnd)
xm d.p d.hwnd 1
Drag hDlg &DDFR_Proc &d
ReleaseDC(d.hwnd d.dc)
ret 1
Function
DDFR_Proc
;/
function button DFR_DATA&d
DrawFocusRect d.dc &d.r ;;erase prev rect
if(button) ret
POINT p; xm p d.hwnd 1
RECT r
r.left=d.p.x; r.top=d.p.y
r.right=p.x; r.bottom=p.y
if(r.right<r.left) _i=r.right; r.right=r.left; r.left=_i
if(r.bottom<r.top) _i=r.bottom; r.bottom=r.top; r.top=_i
DrawFocusRect d.dc &r
d.r=r
Posts: 1,006
Threads: 330
Joined: Mar 2007
Can something like this be used to select rows in QmGrid? I imaging maybe in combination with a key press, eg. alt or something. Depending on what type of column you have (i.e. not a simple text column), the ctrl-Lt click method can act a little funny.
Not important, so only if easy to implement.
Thanks, !!!
Stuart
Posts: 262
Threads: 63
Joined: Nov 2005
Very nice and in less than a day. What a brain!!