Page 1 of 1

Posted: Tue Jun 11, 2002 7:26 am
by BackupUser
Restored from previous forum. Originally posted by cor.

How do I change in realtime the trackbargadget min. max values?

Using Windows 98 SE
Registered PB version : 3.1 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Tue Jun 11, 2002 4:25 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.

If you want to change the position use a thread.
Something like (NOT TESTED YET):

Code: Select all

Global NewValue
 
Procedure ChangeTrackBar()
  Repeat
    SetGadgetState(TrackBar, NewValue) ;this line works - tested!
    Delay(10) ; you need a delay...
  Forever ;or Until something special happens, depending on your code...
EndProcedure
 
CreateThread(@ChangeTrackBar()NotUsed) ;there must be a parameter!
;...here is some code that changes the variable NewValue
If you want to change the min and/or the max values, suppose you have to use FreeGadget and Create a new TrackBar with the same number/position etc. but with different min/max values - and put all these in your main Event Loop or in a Thread like above.
But I think you will see some flickering.
Don't know if there is a API SendMessage_() message for TrackBars. Sorry.
Hope this helps a bit.


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.


Edited by - franco on 11 June 2002 17:35:53

Posted: Mon Jun 17, 2002 9:20 pm
by BackupUser
Restored from previous forum. Originally posted by cor.

Franco,

This works

tbxresult.l=TrackBarGadget(#TBX, 420, 318, 150, 24, 10, 600) ; X Change

;Set min range of Trackbar
SendMessage_(tbxresult,#TBM_SETRANGEMIN,1,20)


;Set max range of Trackbar
SendMessage_(tbxresult,#TBM_SETRANGEMAX,1,200)


But how to implement the following:
the min and max in one command.

SendMessage_(tbxresult,#TBM_SETRANGE,1,200)

How to implement this:

= (LPARAM) MAKELONG (lMinimum, lMaximum)


lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) TBM_SETRANGE, // message ID
(WPARAM) wParam, // = (WPARAM) (BOOL) fRedraw
(LPARAM) lParam // = (LPARAM) MAKELONG (lMinimum, lMaximum)
);




Using Windows 98 SE
Registered PB version : 3.1 (Windows)
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com

Posted: Mon Jun 17, 2002 11:43 pm
by BackupUser
Restored from previous forum. Originally posted by Franco.

Try this:

Code: Select all

 
Procedure MakeLong(Min.l,Max.l)
  ProcedureReturn Min + Max << 16
EndProcedure
 
SendMessage_(tbxresult,#TBM_SETRANGE,1,MakeLong(10,200))
 
Hope this helps...


Have a nice day...
Franco

Sometimes you have to go a lonely way to accomplish genius things.