SG_TrackBarGadget | ||||||||||||||||||||||||||||||
Syntax: | ||||||||||||||||||||||||||||||
Result=SG_TrackBarGadget(SG_GadgetID_L.l, X_Pos_L.l, Y_Pos_L.l, Width_L.l, Height_L.l, StartValue_L.l, EndValue_L.l, [Flags_L.l]) | ||||||||||||||||||||||||||||||
Parameters: | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||
Return Values: | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||
Description: | ||||||||||||||||||||||||||||||
Creates a TrackBar gadget in the current screen. It allows you to select a range of values with a slide bar, like ones found in several multimedia players. The Minimum-Maximum range should be between 0 and 10,000. SG_GadgetID_L will be the numeric identifier returned by SG_EventScreenGadgetID() command. The following commands can be used to act on this gadget: - GetGadgetState(): Returns the current cursor position (value between the Minimum-Maximum range). - SetGadgetState(): Change the current cursor position. - SetGadgetFlag(): Change the current Flag of the gadget | ||||||||||||||||||||||||||||||
Example: | ||||||||||||||||||||||||||||||
#TrackBar_0 = 0 If Not InitSprite() Or Not InitMouse() Or Not InitKeyboard() End EndIf If OpenWindow(1, 0, 0, 1024, 768, "Screen Gadget TrackBar", #PB_Window_BorderLess) If OpenWindowedScreen(WindowID(1), 0,0, 1024, 768, 0, 0, 0) ; create a mouse If CreateSprite(0, 8, 8) If StartDrawing(SpriteOutput(0)) Circle(4, 4, 4, RGB(255, 255, 255)) StopDrawing() EndIf EndIf SG_TrackBarGadget(#TrackBar_0, 700, 500, 200, 20, 1, 100) Repeat ClearScreen(0) SG_DrawGadgets() ExamineMouse() DisplayTransparentSprite(0, MouseX(), MouseY()) FlipBuffers() Event = SG_ScreenGadgetEvent() ; This line checks if an event happened and resolve the mouse actions with the gadgets GadgetID = SG_EventScreenGadgetID() ; Is it a gadget event? EventType = SG_EventType() ; The event type If Event = #PB_Event_Gadget And EventType = #SG_EventType_LeftRelease If GadgetID = #TrackBar_0 Debug SG_GetGadgetState(#TrackBar_0) EndIf EndIf Until WaitWindowEvent() = #PB_Event_CloseWindow EndIf EndIf End | ||||||||||||||||||||||||||||||
Remarks: | ||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||
|