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

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

;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"
;DIALOG EDITOR: "" 0x2030109 "" "0" ""

;int npages=60 ;;change this
sel message
,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_COMMAND goto messages2
,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 "i3 is: %i" i3
,out "i4 is: %i" i4
,out "i5 is: %i" i5
sel wParam
,case IDOK
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.

Jimmy Vig
out GetWinId(lParam)

Function MultiVertTrack
Copy      Help
,ARRAY(str) Track
,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.

Jimmy Vig
Here's a better idea of what I mean:
Function MultiVertTrack
Copy      Help
,int FirstTrackID=3
,int NumberTrack=3
,ARRAY(str) Track
,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?
To get all trackbar handles use function child(). If 7-th argument is array, it receives all handles.
Like this...
Function MultiVertTrack
Copy      Help
,int FirstTrackID
,int NumberTrack
,ARRAY(int) Track
,child("" "" "" 0 0 0 Track)
,for _i 0 Track.len
,,if _s="msctls_trackbar32"
,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
Copy      Help
,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)