Progressbargadget No vertical

Post bugreports for the Mac OSX version here
collectordave
Addict
Addict
Posts: 1275
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Progressbargadget No vertical

Post by collectordave »

Mac OS Mojave 10.14.6

PB 7.3 LTS



Using the code from the help file:

Code: Select all

 If OpenWindow(0, 0, 0, 320, 160, "ProgressBarGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    TextGadget       (3,  10, 10, 250,  20, "ProgressBar Standard  (50/100)", #PB_Text_Center)
    ProgressBarGadget(0,  10, 30, 250,  30, 0, 100)
    SetGadgetState   (0, 50)   ;  set 1st progressbar (ID = 0) to 50 of 100
    TextGadget       (4,  10, 70, 250,  20, "ProgressBar Smooth  (50/200)", #PB_Text_Center)
    ProgressBarGadget(1,  10, 90, 250,  30, 0, 200, #PB_ProgressBar_Smooth)
    SetGadgetState   (1, 50)   ;  set 2nd progressbar (ID = 1) to 50 of 200
    TextGadget       (5, 100,135, 200,  20, "ProgressBar Vertical  (100/300)", #PB_Text_Right)
    ProgressBarGadget(2, 270, 10,  30, 120, 0, 300, #PB_ProgressBar_Vertical)
    SetGadgetState   (2, 100)   ; set 3rd progressbar (ID = 2) to 100 of 300
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndIf
I do not get a vertical progressbar!

Help
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
User avatar
Shardik
Addict
Addict
Posts: 1850
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Progressbargadget No vertical

Post by Shardik »

I have tested the above example on the 4 most recent versions of MacOS. The plus sign denotes that the vertical progress bar is displayed, the minus sign that the vertical progress bar is missing. I have done all tests with PB 5.73:

[+] MacOS 10.13.6 'High Sierra' with PB 5.73 x86
[-] MacOS 10.14.6 'Mojave' with PB 5.73 x64
[-] MacOS 10.15.7 'Catalina' with PB 5.73 x64
[+] MacOS 11.4 'Big Sur' with PB 5.73 x64

So I can confirm the bug report for Mojave and Catalina but High Sierra and Big Sur are fine.
User avatar
Shardik
Addict
Addict
Posts: 1850
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Progressbargadget No vertical

Post by Shardik »

I have found a workaround for displaying a vertical ProgressBar also on Mojave and Catalina. I have successfully tested this workaround on these MacOS versions:
  • MacOS 10.6.8 'Snow Leopard' with PB 5.62 x86
  • MacOS 10.13.6 'High Sierra' with PB 5.73 x86
  • MacOS 10.14.6 'Mojave' with PB 5.73 x64
  • MacOS 10.15.7 'Catalina' with PB 5.73 x64
  • MacOS 11.4 'Big Sur' with PB 5.73 x64

Code: Select all

EnableExplicit

Define Origin.NSPoint
Define Rotation.CGFloat = 270

OpenWindow(0, 270, 100, 280, 200, "Bug-fixed vertical ProgressBar")
ProgressBarGadget(0, WindowWidth(0) / 2, 10, 170, 10, 0, 100)
SetGadgetState(0, 50)

; ----- Change horizontal ProgressBar into vertical ProgressBar

Origin\x = GadgetX(0)
Origin\y = WindowHeight(0) - 15
CocoaMessage(0, GadgetID(0), "setFrameOrigin:@", @Origin)
CocoaMessage(0, GadgetID(0), "setFrameRotation:@", @Rotation)

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
User avatar
mk-soft
Addict
Addict
Posts: 3294
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Progressbargadget No vertical

Post by mk-soft »

Very nice,

but I think bottom to top is right

Code: Select all

EnableExplicit

CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
  
  Procedure FIX_ProgressBarGadget(Gadget, x, y, Width, Height, Minimum, Maximum, Flags = 0)
    If Flags & #PB_ProgressBar_Vertical
      ; ----- Change horizontal ProgressBar into vertical ProgressBar
      Protected Origin.NSPoint
      Protected Rotation.CGFloat = 270
      ProgressBarGadget(Gadget, x, y, Height, Width, Minimum, Maximum) ; Swap width and height
      Origin\x = x
      Origin\y = y + height
      CocoaMessage(0, GadgetID(0), "setFrameOrigin:@", @Origin)
      CocoaMessage(0, GadgetID(0), "setFrameRotation:@", @Rotation)
    Else
      ProgressBarGadget(Gadget, x, y, Width, Height, Minimum, Maximum, Flags)
    EndIf
  EndProcedure
  
  Macro ProgressBarGadget(Gadget, x, y, Width, Height, Minimum, Maximum, Flags = 0)
    FIX_ProgressBarGadget(Gadget, x, y, Width, Height, Minimum, Maximum, Flags)
  EndMacro
  
CompilerEndIf

OpenWindow(0, 270, 100, 280, 200, "Bug-fixed vertical ProgressBar")
ProgressBarGadget(0, 20, 10, 20, 180, 0, 100, #PB_ProgressBar_Vertical)
SetGadgetState(0, 25)

Debug OSVersion()

Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace
User avatar
Shardik
Addict
Addict
Posts: 1850
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Progressbargadget No vertical

Post by Shardik »

mk-soft wrote: Tue Jul 13, 2021 10:23 am but I think bottom to top is right
My example displays bottom to top already... :wink:
I assume that you tested my example shortly after posting which used Rotation = 90 and indeed displayed from top to bottom. But soon after I changed it to bottom to top.
Post Reply