Page 1 of 1

TrackbarGadget & CanvasGadget

Posted: Tue Dec 06, 2022 9:09 pm
by bembulak
Hi all,

Is it possible that the TrackbarGadget is no friend with the CanvasGadget?
I do have a code here where I have both of them and not matter, where I place them, the TrackBarGadget overlaps the Canvas.

Once I remove the trackbar (commenting line 23), the Canvas is visible again.

Do I miss something? Thank you!

Edit:
There seems to be something wrong. I changed the TrackbarGadget to other GadgetTypes and have similar issues (with invisible objects). :?

Code: Select all

Enumeration
  #mainWin        ; Window
  #metroCanvas    ; Canvas / Drawing area
EndEnumeration

Enumeration
  #btnStartStop   ; ToggleButton
  #trkBeats       ; Trackbar
EndEnumeration

#TOGGLED_ON = 1   ; toggle states
#TOGGLED_OFF = 0

#AppTitle = "Demo Trackbar & Canvas"

Declare OnBtnStartStopClick()
Declare GadgetEvents()

; Open The Window and Create Gadgets
OpenWindow(#mainWin, 5, 5, 400, 500, #AppTitle, #PB_Window_SystemMenu)
CanvasGadget(#metroCanvas, 5, 5, 390, 390, #PB_Canvas_Border)
ButtonGadget(#btnStartStop, 5, 400, 64, 32, "Off", #PB_Button_Toggle)
TrackBarGadget(#trkBeats, 5, 450, 390, 5, 1, 4)

; Bind events
BindEvent(#PB_Event_Gadget, @GadgetEvents())
; ===========

Procedure OnBtnStartStopClick()
  Debug "Click"
  Select GetGadgetState(#btnStartStop) ; 1 = toggled, 0 = normal
    Case #TOGGLED_ON
      SetGadgetText(#btnStartStop, "On")
      ; Event
    Case #TOGGLED_OFF
      SetGadgetText(#btnStartStop, "Off")
      ; Event
  EndSelect 
EndProcedure

Procedure GadgetEvents()
  
  Select EventGadget()
    Case #btnStartStop
      OnBtnStartStopClick()
  EndSelect
  
EndProcedure

Re: TrackbarGadget & CanvasGadget

Posted: Tue Dec 06, 2022 9:30 pm
by Peter

Code: Select all

Enumeration
  #mainWin        ; Window
  #metroCanvas    ; Canvas / Drawing area
EndEnumeration

Enumeration
  #btnStartStop   ; ToggleButton
  #trkBeats       ; Trackbar
EndEnumeration
#metroCanvas and #trkBeats have the same values. ;)

Re: TrackbarGadget & CanvasGadget

Posted: Wed Dec 07, 2022 7:37 am
by bembulak
Peter wrote: Tue Dec 06, 2022 9:30 pm

Code: Select all

Enumeration
  #mainWin        ; Window
  #metroCanvas    ; Canvas / Drawing area
EndEnumeration

Enumeration
  #btnStartStop   ; ToggleButton
  #trkBeats       ; Trackbar
EndEnumeration
#metroCanvas and #trkBeats have the same values. ;)
Thank you, Peter.

Forgot so much over the years … OMG. What a mistake.

:insert massive facepalm here:

Re: TrackbarGadget & CanvasGadget

Posted: Wed Dec 07, 2022 10:23 am
by Fred
:lol: