Page 1 of 1

Button width different

Posted: Wed May 11, 2022 5:24 pm
by Danilo
Buttons with height 25 are different in width than buttons created using a height other than 25.

All buttons are created with width 200:

Code: Select all

If OpenWindow(0, 0, 0, 222, 400, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible)
    For i = 0 To 9 Step 2
        ButtonGadget(i,   10, 10+ i   *30, 200, 25, "Standard Button "+i)
        ButtonGadget(i+1, 10, 10+(i+1)*30, 200, 24, "Standard Button "+Str(i+1))
    Next
    HideWindow(0,#False)
    ;SetActiveGadget(-1)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf

Re: Button width different

Posted: Wed May 11, 2022 6:03 pm
by mk-soft
No pb bug

macOS calculation error for inner rounded rectangle. Button height 25 is a bad value.

Code: Select all

NSBackColor = CocoaMessage(0, 0, "NSColor systemOrangeColor")

If OpenWindow(0, 0, 0, 222, 400, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible)
    For i = 0 To 10
      ButtonGadget(i,   10, 10 + i * 35, 200, 30 - i, "Standard Button " + Str(30 - i))
      CocoaMessage(0, GadgetID(i), "setBackgroundColor:", NSBackColor)
    Next
    HideWindow(0,#False)
    ;SetActiveGadget(-1)
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf