Hi,
is there a way to flip the coordinate on a cocoa window, to have the start point in the upper right corner instead of lower corner?
How can I flip coordinate of cocoa
How can I flip coordinate of cocoa
macOS Catalina 10.15.7
Re: How can I flip coordinate of cocoa
Never tried it, but as far as I know you have to change the origin of the window's view with setBoundsOrigin.
However, if you place ui children based from the new 0,0 location they will be invisible if you use positive numbers.
This is because they are placed in the quadrant that is outside the window.
Bottom line: all ui children need to be placed with negative coordinates in order to be visible.
Hope I'm not too far off with my assumption...
However, if you place ui children based from the new 0,0 location they will be invisible if you use positive numbers.
This is because they are placed in the quadrant that is outside the window.
Bottom line: all ui children need to be placed with negative coordinates in order to be visible.
Hope I'm not too far off with my assumption...
I am to provide the public with beneficial shocks.
Alfred Hitshock
Re: How can I flip coordinate of cocoa
Do you only want to flip the y coordinate or both x and y ?
To do both, you could rotate things
To do both, you could rotate things
Code: Select all
If OpenWindow(0, 0, 0, 222, 200, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 200, 20, "Standard Button")
ButtonGadget(1, 10, 40, 200, 20, "Left Button", #PB_Button_Left)
ButtonGadget(2, 10, 70, 200, 20, "Right Button", #PB_Button_Right)
ButtonGadget(3, 10,100, 200, 60, "Multiline Button (longer text gets automatically wrapped)", #PB_Button_MultiLine)
ButtonGadget(4, 10,170, 200, 20, "Toggle Button", #PB_Button_Toggle)
ContentView = CocoaMessage(0, WindowID(0), "contentView")
Rotation.CGFloat = 180
CocoaMessage(0, ContentView, "setBoundsRotation:@", @Rotation)
Origin.CGPoint\x = WindowWidth(0)
Origin\y = WindowHeight(0)
CocoaMessage(0, ContentView, "setBoundsOrigin:@", @Origin)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: How can I flip coordinate of cocoa
I need to flip Y onlywilbert wrote:Do you only want to flip the y coordinate or both x and y ?
macOS Catalina 10.15.7
Re: How can I flip coordinate of cocoa
The NSView class has a method named isFlipped
You can overwrite this method and return #True .
Is that what you are looking for ?
You can overwrite this method and return #True .
Is that what you are looking for ?
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: How can I flip coordinate of cocoa
Hi Wilbert,wilbert wrote:The NSView class has a method named isFlipped
You can overwrite this method and return #True .
Is that what you are looking for ?
isFliped is Deprecated since 10.6 maybe drawInRect:fromRect:operation:fraction:respectFlipped:hints: is the better way.
I will try it in a few days.
Thanks!
macOS Catalina 10.15.7
Re: How can I flip coordinate of cocoa
Where does it say it is deprecated ?Wolfram wrote:isFliped is Deprecated since 10.6
The Apple docs don't seem to mention that
https://developer.apple.com/documentati ... -isflipped
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: How can I flip coordinate of cocoa
In my 10.7 DocSet.wilbert wrote: Where does it say it is deprecated ?
Maybe they recant it.
macOS Catalina 10.15.7
Re: How can I flip coordinate of cocoa
Are you sure you didn’t look at NSImage instead of NSView ?Wolfram wrote:In my 10.7 DocSet.wilbert wrote: Where does it say it is deprecated ?
Maybe they recant it.
For NSImage isFlipped is marked deprecated.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)