Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Buttons on Splitter - moves with splitter & restricted range
#1
Hi All,
Anybody have ideas of how to make this work better.
I would like max min buttons to appear on the splitter itself. Since on splitter, they get attached to it and therefore alter their size problematically. Therefore, I had to put the Detach/Attach controls when moving the buttons following the splitter position. This seems to work ok but the presence of the buttons changes the max range so the max/min buttons only work in one direction.

Any ideas how to make this work better. I looked at draw_on_splitter
Quote:http://www.quickmacros.com/forum/viewtopic.php?p=25221
but can't figure out how to extend to the buttons.
Thanks!!!
S


Function dlg_ButtonsOnSplitter
Code:
Copy      Help
\Dialog_Editor

function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "4 5"
str e4 e5
if(!ShowDialog("dlg_ButtonsOnSplitter" &dlg_ButtonsOnSplitter &controls)) ret

;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 216 249 "Dialog"
;4 Edit 0x54231044 0x200 0 0 216 80 ""
;5 Edit 0x54230844 0x20000 0 94 216 114 ""
;1 Button 0x54030001 0x4 60 224 48 14 "OK"
;2 Button 0x54030000 0x4 124 224 48 14 "Cancel"
;3 Button 0x54032000 0x0 26 216 26 14 "▼"
;6 Button 0x54032000 0x0 0 216 26 14 "▲"
;7 QM_Splitter 0x54000000 0x0 0 80 216 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030605 "*" "" "" ""

ret
;messages
DlgSplitter ds.Init(hDlg 7)
sel message
,case WM_INITDIALOG
,,SetTimer hDlg 1 100 0
,case WM_TIMER
,,sel wParam    
,,,case 1
,,,,int c=id(7 hDlg) ;;QM_Splitter
,,,,int x y cx cy
,,,,GetWinXY c x y cx cy hDlg
,,,,ds.AttachControls(0)
,,,,mov+ 0 y 40 cy id(3 hDlg) 1
,,,,mov+ 0 y 40 cy id(6 hDlg) 1
,,,,ds.AttachControls(1)
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3 ds.SetPos(ds.GetMaxPos)
,case 6 ds.SetPos(0)
ret 1
#2
In ___SPLITTER.WndProc replace
Code:
Copy      Help
,case WM_SETCURSOR
,if(!m_disabled)
,,SetCursor m_hCursor
,,ret 1
to
Code:
Copy      Help
,case WM_SETCURSOR
,if(!m_disabled and wParam=hWnd)
,,SetCursor m_hCursor
,,ret 1
,
,case [WM_COMMAND,WM_NOTIFY]
,ret SendMessage(GetParent(hWnd) message wParam lParam)

Then can add controls on a splitter as its child windows. Splitter will relay WM_COMMAND and WM_NOTIFY messages to its parent window (dialog).
Function dlg_ButtonsOnSplitter
Code:
Copy      Help
\Dialog_Editor

function# hDlg message wParam lParam
if(hDlg) goto messages

InitSplitter

str controls = "4 5"
str e4 e5
if(!ShowDialog("dlg_ButtonsOnSplitter" &dlg_ButtonsOnSplitter &controls)) ret

;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 216 249 "Dialog"
;4 Edit 0x54231044 0x200 0 0 216 80 ""
;5 Edit 0x54230844 0x20000 0 94 216 114 ""
;1 Button 0x54030001 0x4 60 224 48 14 "OK"
;2 Button 0x54030000 0x4 124 224 48 14 "Cancel"
;3 Button 0x54032000 0x0 26 80 26 14 "▼"
;6 Button 0x54032000 0x0 0 80 26 14 "▲"
;7 QM_Splitter 0x54000000 0x0 0 80 216 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030606 "*" "" "" ""

ret
;messages
DlgSplitter ds.Init(hDlg 7)
sel message
,case WM_INITDIALOG
,int hSplitter(id(7 hDlg)) hb6(id(6 hDlg)) hb3(id(3 hDlg))
,GetWinXY hb6 0 0 _i
,SetParent hb6 hSplitter; mov 0 0 hb6
,SetParent hb3 hSplitter; mov _i 0 hb3
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3 ds.SetPos(ds.GetMaxPos)
,case 6 ds.SetPos(0)
ret 1
#3
works almost TOO well. You are simply the best!
Thanks, S


Forum Jump:


Users browsing this thread: 1 Guest(s)