COCOA quests?
COCOA quests?
Exist some thing in OSX (cocoa or other way) similar to MSAPI:
FindWindow_(0, win_name.s)
SetParent_(hWnd,WindowID(window))
SendMessage_(hWnd,#WM_CLOSE,0,0)
MoveWindow_(hWnd,x,y,w,h,#True)
Somebody can help with this?
Thanks a lot!
FindWindow_(0, win_name.s)
SetParent_(hWnd,WindowID(window))
SendMessage_(hWnd,#WM_CLOSE,0,0)
MoveWindow_(hWnd,x,y,w,h,#True)
Somebody can help with this?
Thanks a lot!
If translation=Error: reply="Sorry, Im Spanish": Endif
Re: COCOA quests?
It helps if you explain what those windows api calls actually do.
On OSX you use CocoaMessage.
For example to close a window
or to add a child window
On OSX you use CocoaMessage.
For example to close a window
Code: Select all
CocoaMessage(0, WindowID(0), "close")
Code: Select all
CocoaMessage(0, WindowID(0), "addChildWindow:", WindowID(1), "ordered:", 1); NSWindowAbove = 1
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: COCOA quests?
Wow! Thanks willbert!
Do you know how set position window?, some thing like setposition(hwnd,x,y,w,h)
Do you know how set position window?, some thing like setposition(hwnd,x,y,w,h)
If translation=Error: reply="Sorry, Im Spanish": Endif
Re: COCOA quests?
Why not with native PB-Function ResizeWindow(...)minimy wrote: Do you know how set position window?, some thing like setposition(hwnd,x,y,w,h)
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
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: COCOA quests?
Hi mk-soft! because i need a window based in a handle not in windowid or window number. Is not a PBwindow.mk-soft wrote:Why not with native PB-Function ResizeWindow(...)minimy wrote: Do you know how set position window?, some thing like setposition(hwnd,x,y,w,h)
Thanks for help.
If translation=Error: reply="Sorry, Im Spanish": Endif
Re: COCOA quests?
Screen coordinates are flipped. (0, 0) is the bottom left of the screen.minimy wrote:Do you know how set position window?
Set bottom left coordinate of window
Code: Select all
Point.NSPoint\x = 100
Point\y = 100
CocoaMessage(0, WindowID(0), "setFrameOrigin:@", @Point)
Code: Select all
Point.NSPoint\x = 100
Point\y = 100
CocoaMessage(0, WindowID(0), "setFrameTopLeftPoint:@", @Point)
Code: Select all
CocoaMessage(0, WindowID(0), "center")
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: COCOA quests?
Hi willbert! Fantastic! its exactly i need.
Thousend thanks to both for quick and perfect answer!
Thousend thanks to both for quick and perfect answer!
If translation=Error: reply="Sorry, Im Spanish": Endif
Re: COCOA quests?
In regards to Center Window:
Just be aware that your perception of center will probably not match Apple's perception of center.
More info in this thread.
Just be aware that your perception of center will probably not match Apple's perception of center.
More info in this thread.
I am to provide the public with beneficial shocks.
Alfred Hitshock
Re: COCOA quests?
Is there something like this in cocoa?
Code: Select all
SetParent_ (GadgetID (Gadget_1), GadgetID (Gadget_2))
Re: COCOA quests?
You can use addSubview:mestnyi wrote:Is there something like this in cocoa?Code: Select all
SetParent_ (GadgetID (Gadget_1), GadgetID (Gadget_2))
Code: Select all
OpenWindow(0, 0, 0, 320, 250, "addSubview: example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
FrameGadget(0, 10, 10, 300, 50, "FrameGadget")
TextGadget(1, 0, 0, 250, 20, "TextGadget")
CocoaMessage(0, GadgetID(0), "addSubview:", GadgetID(1))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: COCOA quests?
Hi, in principle, it solved my problem at the moment, thank you.
But why here from the bottom up?
It does not move the listview, listicon, tree.
Can you help me with this?
Thanks again.
But why here from the bottom up?
It does not move the listview, listicon, tree.
Can you help me with this?
Thanks again.
Code: Select all
OpenWindow(0, 0, 0, 320, 320, "addSubview: example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 10, 10, 300, 300)
ButtonGadget(1, 50, 10, 150, 20, "ButtonGadget")
CocoaMessage(0, GadgetID(0), "addSubview:", GadgetID(1))
; ResizeGadget(1, #PB_Ignore, 300-20-10, #PB_Ignore, #PB_Ignore)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: COCOA quests?
I'm not sure if I understand your question but with Cocoa, coordinates are different.mestnyi wrote:But why here from the bottom up?
(0,0) is bottom left instead of top left.
PureBasic normally handles this for you so coordinates work the same on all supported platforms but in this case you will have to handle the different coordinates yourself.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: COCOA quests?
I talk about it.
Code: Select all
OpenWindow(0, 0, 0, 320, 320, "addSubview: example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 10, 10, 300, 300)
ListViewGadget(1, 50, 10, 150, 50)
AddGadgetItem(1,-1, "ListView_1")
AddGadgetItem(1,-1, "ListView_2")
CocoaMessage(0, GadgetID(0), "addSubview:", GadgetID(1))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: COCOA quests?
Sorry, I don't know a solution.mestnyi wrote:I talk about it.
Canvas is not just a simple Cocoa object. It's made up of multiple objects.
I don't know if you are aware of it but you can use a canvas as a container.
Code: Select all
OpenWindow(0, 0, 0, 320, 320, "Canvas container", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 10, 10, 300, 300, #PB_Canvas_Container)
ListViewGadget(1, 50, 10, 150, 50)
CloseGadgetList()
AddGadgetItem(1,-1, "ListView_1")
AddGadgetItem(1,-1, "ListView_2")
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: COCOA quests?
Similarly, the list view consists of several objects. I think the problem is with this.Canvas is not just a simple Cocoa object. It's made up of multiple objects.
in Linux it was also similar, but there I could get a parent and a child, but here I do not know how to do it.
And generally, how do you convert the code of the apple into the code of the purebasic
why the apple documentation has two functions?
How to use these functions in the Purebasic?
I do not understand help me please.
Code: Select all
; func addSubview(_ view: UIView)
; func addSubview(_ view: NSView)
CocoaMessage (0, GadgetID (Gadget), "addSubview:", GadgetID (Gadget_1))
What is going on here where you can find out how you know where you read it?
Code: Select all
; func bringSubviewToFront(_ view: UIView)
CocoaMessage (0, GadgetID (Gadget), "bringSubviewToFront:", GadgetID (Gadget_1))