It is currently Tue Mar 09, 2021 9:17 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: PB v5.x - Set default font on ComboGadget crashed
PostPosted: Fri Jan 01, 2021 1:24 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2890
Location: Germany
Click on gadget
Quote:
[13:20:09] [ERROR] *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]

Code:
OpenWindow(0, 0, 0, 200, 200, "ComboBox macOS")
ComboBoxGadget(0, 5, 5, 190, 24)
SetGadgetFont(0, #PB_Default)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

Workaround
Code:
;-TOP

; Comment: Fix Set default font on macOS
; Version: v1.0.0
; Author : mk-soft
; Create : 1.1.2021

CompilerIf #PB_Compiler_OS = #PB_OS_MacOS
 
  Macro _PB_(Function)
    Function
  EndMacro
 
  Procedure FixSetGadgetFont(Gadget, FontID)
    Static SystemFontID
    Protected FontSize.CGFloat
    If FontID = #PB_Default
      If Not SystemFontID
        CocoaMessage(@FontSize, 0, "NSFont systemFontSize") : FontSize - 1
        SystemFontID = CocoaMessage(0, 0, "NSFont systemFontOfSize:@", @FontSize)
      EndIf
      _PB_(SetGadgetFont)(Gadget, SystemFontID)
    Else
      _PB_(SetGadgetFont)(Gadget, FontID)
    EndIf
  EndProcedure
 
  Macro SetGadgetFont(Gadget, FontID)
    FixSetGadgetFont(Gadget, FontID)
  EndMacro
 
CompilerEndIf

; ****

CompilerIf #PB_Compiler_IsMainFile
  OpenWindow(0, 0, 0, 200, 200, "ComboBox macOS")
  ComboBoxGadget(0, 5, 5, 190, 30, #PB_ComboBox_Editable)
  StringGadget(1, 5, 40, 190, 30, "Item 1")
  AddGadgetItem(0, -1, "Item 1")
  AddGadgetItem(0, -1, "Item 2")
  SetGadgetFont(0, #PB_Default)
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
CompilerEndIf

_________________
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye