Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Individual Trackbar cases.
#1
Example:
Function MultiVertTrack
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

if(!ShowDialog("MultiVertTrack" &MultiVertTrack)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 268 402 "Reverb Control"
;3 msctls_trackbar32 0x54030003 0x0 3 3 24 399 ""
;4 msctls_trackbar32 0x54030003 0x0 30 3 24 399 ""
;5 msctls_trackbar32 0x54030003 0x0 57 3 24 399 ""
;1 Button 0x54030001 0x4 142 146 48 14 "OK"
;2 Button 0x54030000 0x4 192 146 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030109 "" "0" ""

ret
;messages
;int npages=60 ;;change this
sel message
,case WM_INITDIALOG
,SendMessage id(3 hDlg) TBM_SETRANGE 0 60<<16
,SendMessage id(4 hDlg) TBM_SETRANGE 0 60<<16
,SendMessage id(5 hDlg) TBM_SETRANGE 0 60<<16
,;SendMessage(id(3 hDlg) TBM_SETPOS 1 59);;example of loading position
,case WM_DESTROY
,case WM_COMMAND goto messages2
,case WM_VSCROLL
,int i3=SendMessage(id(3 hDlg) TBM_GETPOS 0 0)
,int i4=SendMessage(id(4 hDlg) TBM_GETPOS 0 0)
,int i5=SendMessage(id(5 hDlg) TBM_GETPOS 0 0)
,out
,out "i3 is: %i" i3
,out "i4 is: %i" i4
,out "i5 is: %i" i5
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

How would you make individual cases for each trackbar so that it would only output individual actions? The outputs here will actually be passing variables to run functions. I would like to avoid running all the functions everytime I am changing only one parameter.

Thanks,
Jimmy Vig
#2
out GetWinId(lParam)
#3
Thanks.

Function MultiVertTrack
Code:
Copy      Help
,ARRAY(str) Track
,Track.create(6)
,Track[3]=SendMessage(id(3 hDlg) TBM_GETPOS 0 0)
,Track[4]=SendMessage(id(4 hDlg) TBM_GETPOS 0 0)
,Track[5]=SendMessage(id(5 hDlg) TBM_GETPOS 0 0)
,int WinID=GetWinId(lParam)
,out WinID
,out Track[WinID]

Is there anyway to grab the number of trackbars in a dialog and automatically run a code for each? I would make sure that the tackbars all went sequentially when building the dialog.

Thanks,
Jimmy Vig
#4
Here's a better idea of what I mean:
Function MultiVertTrack
Code:
Copy      Help
,int FirstTrackID=3
,int NumberTrack=3
,ARRAY(str) Track
,Track.create(NumberTrack+FirstTrackID)
,for _i FirstTrackID NumberTrack+FirstTrackID
,,Track[_i]=SendMessage(id(_i hDlg) TBM_GETPOS 0 0)
,out Track[GetWinId(lParam)]


So anyway to find the number of trackbars and what the lowest id would be?
#5
To get all trackbar handles use function child(). If 7-th argument is array, it receives all handles.
#6
Like this...
Function MultiVertTrack
Code:
Copy      Help
,int FirstTrackID
,int NumberTrack
,ARRAY(int) Track
,child("" "" "" 0 0 0 Track)
,for _i 0 Track.len
,,_s.getwinclass(Track[_i])
,,if _s="msctls_trackbar32"
,,,NumberTrack+1
,,,FirstTrackID=_i+1
,Track.create(NumberTrack+FirstTrackID)
,for _i FirstTrackID NumberTrack+FirstTrackID
,,Track[_i]=SendMessage(id(_i hDlg) TBM_GETPOS 0 0)
,out "TrackBar %i is %i" GetWinId(lParam) Track[GetWinId(lParam)]

This makes more sense and is easier:
Function MultiVertTrack
Code:
Copy      Help
,out
,
,out _s.getwinclass(id(GetWinId(lParam) hDlg))
,if _s="msctls_trackbar32"
,,int Val=SendMessage(id(GetWinId(lParam) hDlg) TBM_GETPOS 0 0)
,out "%i value is %i" GetWinId(lParam) Val


Forum Jump:


Users browsing this thread: 1 Guest(s)