MacOS "superview"

Mac OSX specific forum
User avatar
mk-soft
Always Here
Always Here
Posts: 5393
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

MacOS "superview"

Post by mk-soft »

The gadgets have no superview if they are in a second item of a PanelGadget.

Maybe you forgot to set this internally when creating the gadgets?

Code: Select all

If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  PanelGadget     (0, 8, 8, 306, 203)
  AddGadgetItem (0, -1, "Panel 1")
  PanelGadget (1, 5, 5, 290, 166)
  AddGadgetItem(1, -1, "Sub-Panel 1")
  AddGadgetItem(1, -1, "Sub-Panel 2")
  AddGadgetItem(1, -1, "Sub-Panel 3")
  CloseGadgetList()
  AddGadgetItem (0, -1,"Panel 2")
  ButtonGadget(2, 10, 15, 80, 24,"Button 1")
  ButtonGadget(3, 95, 15, 80, 24,"Button 2")
  CloseGadgetList()
  
  Debug "Panel = " + GadgetID(0)
  Debug "Panel 1 = " + GadgetID(1)
  Debug "Button 2 = " + GadgetID(2)
  
  sv = CocoaMessage(0, GadgetID(1), "superview")
  sv = CocoaMessage(0, sv, "superview")
  Debug "Parent from Panel 1 = " + sv
  
  sv = CocoaMessage(0, GadgetID(2), "superview")
  sv = CocoaMessage(0, sv, "superview")
  Debug "Parent from Gadget 2 = " + sv
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
[/size]
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5393
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: MacOS "superview"

Post by mk-soft »

I think is not a Bug...

PB
PanelGadget -> AddItems -> Gadgets

OSX
TabView -> TabViewItems -> View -> (gadgets)
Problem is that the "View" have not a method to parent object.

Perhaps anyone habe a solution for me...

Please move to Code questions...
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: MacOS "superview"

Post by wilbert »

I looked at it but unfortunately didn’t find an answer to the problem. :?
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
mk-soft
Always Here
Always Here
Posts: 5393
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: MacOS "superview"

Post by mk-soft »

wilbert wrote:I looked at it but unfortunately didn’t find an answer to the problem. :?
I've searched several forums.
Here you can only use the forward approach to search all TabViewControllers until you have found the right one.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
mestnyi
Addict
Addict
Posts: 1000
Joined: Mon Nov 25, 2013 6:41 am

Re: MacOS "superview"

Post by mestnyi »

Code: Select all

If OpenWindow(0, 0, 0, 322, 220, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  PanelGadget     (0, 8, 8, 306, 203)
  AddGadgetItem (0, -1, "Panel 1")
  PanelGadget (1, 5, 5, 290, 166)
  AddGadgetItem(1, -1, "Sub-Panel 1")
  AddGadgetItem(1, -1, "Sub-Panel 2")
  AddGadgetItem(1, -1, "Sub-Panel 3")
  CloseGadgetList()
  AddGadgetItem (0, -1,"Panel 2")
  ButtonGadget(2, 10, 15, 80, 24,"Button 1")
  ButtonGadget(3, 95, 15, 80, 24,"Button 2")
  CloseGadgetList()
  
  Debug "Panel = " + GadgetID(0)
  Debug "Panel 1 = " + GadgetID(1)
  Debug "Button 2 = " + GadgetID(2)
  
  sv = CocoaMessage(0, GadgetID(1), "superview")
  sv = CocoaMessage(0, sv, "superview")
  Debug "Parent from Panel 1 = " + sv
  
  SetGadgetState(0, 1)
  sv = CocoaMessage(0, GadgetID(2), "superview")
  sv = CocoaMessage(0, sv, "superview")
  Debug "Parent from Gadget 2 = " + sv
  SetGadgetState(0, 0)
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
This is how it works. :)
User avatar
mk-soft
Always Here
Always Here
Posts: 5393
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: MacOS "superview"

Post by mk-soft »

However, this does not help if you are looking for the parent gadget for any gadget.
So we know that with the PanelGadget the active item only has a superview.

That's why in the forum for Objectiv-C you can only find the solution to find the right parent by searching all PanelGadgets forward.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply