Tahoe and text rendering

Mac OSX specific forum
mrbungle
Enthusiast
Enthusiast
Posts: 149
Joined: Wed Dec 30, 2020 3:18 am

Tahoe and text rendering

Post by mrbungle »

macOS Tahoe changed how some UI gadgets render. You may have to force macOS to redraw the element using something like:

Code: Select all

view = GadgetID(#GadgetID)
CocoaMessage(0, view, "setNeedsLayout:", #YES)
CocoaMessage(0, view, "layoutIfNeeded")
CocoaMessage(0, view, "setNeedsDisplay:", #YES)
Fred
Administrator
Administrator
Posts: 18178
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Tahoe and text rendering

Post by Fred »

Which gadget are affected ? It looks like a bug IMHO
mrbungle
Enthusiast
Enthusiast
Posts: 149
Joined: Wed Dec 30, 2020 3:18 am

Re: Tahoe and text rendering

Post by mrbungle »

It was a text gadget. I used text gadgets and a scroll area gadget to display content organized into pages. There were buttons in the UI as well. On macOS versions 15 and lower, clicking the scroll bar worked as expected and the content paged. On macOS Tahoe betas, it did not update and page the UI contents the UI until I forced a redraw.
Fred
Administrator
Administrator
Posts: 18178
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Tahoe and text rendering

Post by Fred »

Do you have a small sample ?
mrbungle
Enthusiast
Enthusiast
Posts: 149
Joined: Wed Dec 30, 2020 3:18 am

Re: Tahoe and text rendering

Post by mrbungle »

I had seen some scattered feedback searching on the web that other developers were experiencing similar issues with redraws. It could be an Apple bug, or an undocumented change in behavior.
mrbungle
Enthusiast
Enthusiast
Posts: 149
Joined: Wed Dec 30, 2020 3:18 am

Re: Tahoe and text rendering

Post by mrbungle »

Not sure if this is helpful:

I create the original gadgets with a separate procedure (as a template) and then populate them with a different one using setgadgettext(). Because each row in a page has gadgets to control things like editing or deleting items and I employ paging for potentially hundreds of entries, I hide gadgets not in the current page view. This arrangement worked flawlessly on macOS 13-15 but failed to update on Tahoe. Once I added the code to force a UI redraw, it worked fine. I added other code like forcing a redraw and hiding and unhiding gadgets, but nothing worked. Only forcing a re-draw did.

Code: Select all

If Not IsGadget(#Gadget_Base_Category + index)
        ButtonGadget(#Gadget_Base_Category + index, 564 - categoryWidth, yPos + 27, categoryWidth, 20, category)
        CocoaMessage(0, GadgetID(#Gadget_Base_Category + index), "setBezelStyle:", 13)
        SetGadgetFont(#Gadget_Base_Category + index, LoadFont(#GadgetFont, #DisplayFont$, 10))
      Else
      	SetGadgetText(#Gadget_Base_Category + index, category)
      	ResizeGadget(#Gadget_Base_Category + index, 564 - categoryWidth, yPos + 27, categoryWidth, 20)
      EndIf
      HideGadget(#Gadget_Base_Category + index, #True)
	  HideGadget(#Gadget_Base_Category + index, #False)
       ; force icon
      view = GadgetID(#Gadget_Base_Category + index)
      CocoaMessage(0, view, "setNeedsLayout:", #YES)
      CocoaMessage(0, view, "layoutIfNeeded")
      CocoaMessage(0, view, "setNeedsDisplay:", #YES)
      
      If Not IsGadget(#Gadget_Base_Edit + index)
        ButtonGadget(#Gadget_Base_Edit + index, 576, yPos + 6, 50, 40, "Edit")
      EndIf
      HideGadget(#Gadget_Base_Edit + index, #False)
Last edited by mrbungle on Mon Aug 25, 2025 2:53 pm, edited 1 time in total.
mrbungle
Enthusiast
Enthusiast
Posts: 149
Joined: Wed Dec 30, 2020 3:18 am

Re: Tahoe and text rendering

Post by mrbungle »

The gadgets will appear. The issue is they will not update with new values for setgadgettext() once you page to a new screen.
Post Reply