I am trying to port my Windows/Linux app to OSX.
My PanelGadget has 10 tabs. The titles will depend on the user so the overall width is not constant. Both Windows and Linux handle this by scroll buttons at each end when the panel is wider than the main window (not resizable). OSX appears to lop off those on the ends, centering what's left. You can see Windows/Linux screenshots at http://davehouston.org/roZetta.htm.
PanelGadget under OSX
PanelGadget under OSX
Last edited by dhouston on Wed Aug 25, 2010 12:42 pm, edited 1 time in total.
Re: MenuGadget & PanelGadget under OSX
You're right, it's a 'known' problem. Actually the OS X API doesn't even support tab scrolling, so we tried to implement some hacks without success. Just ensure than all fit on the screen, or use a different MDI selector, like a listviewgadget().
Re: PanelGadget under OSX
OK. I will need to experiment a little. Years ago I had an app where I thought the VB tab control looked too clunky (It had multiple rows when the horizontal space was too small.) so I created a crude one just using...Fred wrote:You're right, it's a 'known' problem. Actually the OS X API doesn't even support tab scrolling, so we tried to implement some hacks without success. Just ensure than all fit on the screen, or use a different MDI selector, like a listviewgadget().
Code: Select all
| Vertical | Dividers | Between | Titles |
Re: PanelGadget under OSX
Perhaps this should be a Feature Request but since it is being discussed here...
I would really like to preserve the "look & feel" of my app across all three versions. I have 10 panels and each panel contains a large ListViewGadget and 7 ButtonGadgets. It makes for a very simple and intuitive user interface.
Fred, would it be possible to add an optional parameter to the PanelGadget that would suppress the drawing of the tabs? That way I could put buttons in place of the tabs and simulate horizontal scrolling of the buttons when necessary. This would preserve the "look & feel" as well as require a minimal amount of recoding (another desire).
I would really like to preserve the "look & feel" of my app across all three versions. I have 10 panels and each panel contains a large ListViewGadget and 7 ButtonGadgets. It makes for a very simple and intuitive user interface.
Fred, would it be possible to add an optional parameter to the PanelGadget that would suppress the drawing of the tabs? That way I could put buttons in place of the tabs and simulate horizontal scrolling of the buttons when necessary. This would preserve the "look & feel" as well as require a minimal amount of recoding (another desire).
Re: PanelGadget under OSX
Dave,
have you already tried to switch to small tabs and see whether your 10 tabs are
visible without being cut at the edges of your PanelGadget?
Please try this small code example to see what I mean:
have you already tried to switch to small tabs and see whether your 10 tabs are
visible without being cut at the edges of your PanelGadget?
Please try this small code example to see what I mean:
Code: Select all
#kControlEntireControl = 0
#kControlSizeSmall = 1
#kControlSizeTag = 'size'
#kControlTabSizeSmall = #kControlSizeSmall
#noErr = 0
ImportC ""
SetControlData(Control.L, ControlPartCode.L, TagName.L, BufferSize.L, *Buffer)
EndImport
OpenWindow(0, 0, 0, 320, 220, "PanelGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
PanelGadget(0, 10, 5, 300, 175)
ButtonGadget(1, 80, 190, 150, 20, "Reduce tab size")
For i = 1 To 5
AddGadgetItem(0, -1, "Panel " + Str(i))
Next i
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 1
TabSize.W = #kControlTabSizeSmall
SetControlData(GadgetID(0), #kControlEntireControl, #kControlSizeTag, SizeOf(TabSize), @TabSize)
SetGadgetState(0, 1)
DisableGadget(1, #True)
SetActiveGadget(0)
EndIf
EndSelect
ForEver
Re: PanelGadget under OSX
@Shardik,
I'm happy with the two main panels dividing things into smaller sub-panels as suggested by Vera in another thread. Since OSX has no menu bar atop the app, the overall size of my main screen stays similar to those for Windows and Linux, maintaining the look and feel across platforms so I don't need to maintain user manuals that have vast differences. See screenshots at...http://davehouston.org/roZetta.htm
The problem is that the PC, Mac, whatever interfaces with an embedded device which has up to 6 serial ports and up to 16 GPIO ports which then interface with multiple devices. The exact configuration depends on just what hardware each end user has. And, there may be as yet unreleased devices for it to interface with, as well. So I need either the flexibility of scrollable tabs or multiple panels.
Still, I'll try your example when I next fire up the Mini. Even if I don't use it in this project, it may be useful in some future project. Thanks for your suggestions both here and in other threads.
I'm happy with the two main panels dividing things into smaller sub-panels as suggested by Vera in another thread. Since OSX has no menu bar atop the app, the overall size of my main screen stays similar to those for Windows and Linux, maintaining the look and feel across platforms so I don't need to maintain user manuals that have vast differences. See screenshots at...http://davehouston.org/roZetta.htm
The problem is that the PC, Mac, whatever interfaces with an embedded device which has up to 6 serial ports and up to 16 GPIO ports which then interface with multiple devices. The exact configuration depends on just what hardware each end user has. And, there may be as yet unreleased devices for it to interface with, as well. So I need either the flexibility of scrollable tabs or multiple panels.
Still, I'll try your example when I next fire up the Mini. Even if I don't use it in this project, it may be useful in some future project. Thanks for your suggestions both here and in other threads.
http://davehouston.org
Mac Mini (Intel) 10.6.8 - iMac G4 (PPC) 10.4.11
Dell Dimension 2400 W98SE,W2K,XP,Vista,W7,Debian,Ubuntu,Kubuntu,Xubuntu,Fedora,Mandriva,Mint
(on swappable HDDs)
Vizio VTAB1008 - Android 3.1
MK808 miniAndroidPC (Android 4.1)
Mac Mini (Intel) 10.6.8 - iMac G4 (PPC) 10.4.11
Dell Dimension 2400 W98SE,W2K,XP,Vista,W7,Debian,Ubuntu,Kubuntu,Xubuntu,Fedora,Mandriva,Mint
(on swappable HDDs)
Vizio VTAB1008 - Android 3.1
MK808 miniAndroidPC (Android 4.1)
Re: PanelGadget under OSX
I just discovered in the header file HITheme.h of my OS X 10.6 SDK
that there even exits a Mini tab size which is even smaller than
kControlSizeSmall in my previous code example. Therefore I want
to present a new example which toggles between 3 tab sizes:
normal, small and mini.
Another interesting feature of this example is that I solved the
problem of redraw errors in the PanelGadget. To see what I mean
simply comment out the lineThe tabs are redrawn by Draw1Control_() but the window background
is not updated. Therefore the need to invalidate the area around the
tabs by InvalWindowRect() so that MacOS is informed to redraw the
given area behind the tabs.
Hint to Fred and freak:
This also might be a solution to solve Andre's bug posting Refreshing
with Container &small ListIcon or to eliminate the drawing artefact of
my bug posting [4.60 B1] New Mac help: no positioning and drawing
artefact...
An alternative way to display lots of tabs would be to use the new
CanvasGadget in the way it is implemented cross-platform in the
new PB IDE of 4.60. STARGÅTE has posted an image and a download
link to his nice TabBarGadget:
http://www.purebasic.fr/english/viewtop ... 12&t=47588
that there even exits a Mini tab size which is even smaller than
kControlSizeSmall in my previous code example. Therefore I want
to present a new example which toggles between 3 tab sizes:
normal, small and mini.
Another interesting feature of this example is that I solved the
problem of redraw errors in the PanelGadget. To see what I mean
simply comment out the line
Code: Select all
InvalWindowRect(WindowID(0), @Bounds)
is not updated. Therefore the need to invalidate the area around the
tabs by InvalWindowRect() so that MacOS is informed to redraw the
given area behind the tabs.
Hint to Fred and freak:
This also might be a solution to solve Andre's bug posting Refreshing
with Container &small ListIcon or to eliminate the drawing artefact of
my bug posting [4.60 B1] New Mac help: no positioning and drawing
artefact...
Code: Select all
EnableExplicit
ImportC ""
InvalWindowRect(WindowRef.L, *Bounds)
SetControlData(Control.L, ControlPartCode.L, TagName.L, BufferSize.L, *Buffer)
EndImport
#kControlEntireControl = 0
#kHIThemeTabSizeMini = 3
#kHIThemeTabSizeNormal = 0
#kHIThemeTabSizeSmall = 1
#kControlSizeTag = 'size'
Structure Rect
Top.W
Left.W
Bottom.W
Right.W
EndStructure
Define Bounds.Rect
Define GadgetID.L
Define i.L
Dim TabSize.W(2)
TabSize(0) = #kHIThemeTabSizeNormal
TabSize(1) = #kHIThemeTabSizeSmall
TabSize(2) = #kHIThemeTabSizeMini
OpenWindow(0, 270, 100, 320, 245, "Change Tab size of PanelGadget")
PanelGadget(0, 10, 5, 300, 175)
Frame3DGadget(1, 10, 190, WindowWidth(0) - 20, 45, "Tab size:")
OptionGadget(2, GadgetX(1) + 10, GadgetY(1) + 18, 70, 20, "Normal")
OptionGadget(3, GadgetX(1) + 120, GadgetY(1) + 18, 60, 20, "Small")
OptionGadget(4, GadgetX(1) + 230, GadgetY(1) + 18, 50, 20, "Mini")
SetGadgetState(2, #True)
For i = 1 To 4
AddGadgetItem(0, -1, "Panel " + Str(i))
Next i
Bounds\Left = 0
Bounds\Top = 0
Bounds\Right = WindowWidth(0)
Bounds\Bottom = 40
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
GadgetID = EventGadget()
Select GadgetID
Case 2 To 4
SetControlData(GadgetID(0), #kControlEntireControl, #kControlSizeTag, 2, @TabSize(GadgetID - 2))
Draw1Control_(GadgetID(0))
InvalWindowRect(WindowID(0), @Bounds)
EndSelect
EndSelect
ForEver
CanvasGadget in the way it is implemented cross-platform in the
new PB IDE of 4.60. STARGÅTE has posted an image and a download
link to his nice TabBarGadget:
http://www.purebasic.fr/english/viewtop ... 12&t=47588