Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog: Trackbar example
#1
i want a slider for setting a dialogs transparency *.
how do i set initial 255 steps for the trackbar32 ?
currently its 0-100.
or do i misunderstand the concept ?

TransDialog2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("TransDialog2" &TransDialog2)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 361 290 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 msctls_trackbar32 0x54030000 0x0 10 8 88 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_HSCROLL
,,int sl(id(3 hDlg))
,,sel GetDlgCtrlID(lParam)
,,,case 3
,,,,out GetTrackbarInfo(sl)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam

,case IDOK
,case IDCANCEL
ret 1

*
the real idea is to attach later on toolbars to all open windows with extra window option
buttons (rollup, taskmin, move to desk n, transslider).
related topics:
Scrollbar, trackbar (slider)
opacity



thanks
pi
#2
Send message either TBM_SETRANGEMIN or TBM_SETRANGEMAX.
#3
msdn:
TBM_SETRANGEMAX Message


result:

TransDialog2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("TransDialog2" &TransDialog2)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 244 178 "Dialog"
;1 Button 0x54030001 0x4 12 46 48 14 "OK"
;2 Button 0x54030000 0x4 66 46 48 14 "Cancel"
;3 msctls_trackbar32 0x54030000 0x0 10 8 152 12 ""
;END DIALOG
;DIALOG EDITOR: "" 0x202000B "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,,int-- sl(id(3 hDlg))
,,SendMessage sl TBM_SETRANGEMAX 1 255
,case WM_DESTROY
,case WM_HSCROLL
,,;int sl(id(3 hDlg))
,,sel GetDlgCtrlID(lParam)
,,,case 3
,,,,out GetTrackbarInfo(sl)
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam

,case IDOK
,case IDCANCEL
ret 1
pi
#4
OK, do i need the GetTrackbarInfo function?
#5
yes.
pi
#6
Where can i find that function?
#7
Function ( GetTrackbarInfo )
Code:
Copy      Help
;/
function# hwndTB [&rangeMin] [&rangeMax]

;Returns trackbar control thumb position and optionally more info.


def TBM_GETPOS (WM_USER)
def TBM_GETRANGEMIN (WM_USER+1)
def TBM_GETRANGEMAX (WM_USER+2)

if(&rangeMin) rangeMin=SendMessage(hwndTB TBM_GETRANGEMIN 0 0)
if(&rangeMax) rangeMax=SendMessage(hwndTB TBM_GETRANGEMAX 0 0)
ret SendMessage(hwndTB TBM_GETPOS 0 0)
Taking on Quick Macros one day at a time
#8
OK thanks!
#9
QM_Expert Wrote:Where can i find that function?

the forum has a 2 search functions.
Scrollbar, trackbar (slider)

:evil:
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)