It is currently Fri Jul 28, 2017 7:58 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: COCOA quests?
PostPosted: Sat Feb 11, 2017 5:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jul 08, 2013 8:43 pm
Posts: 218
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!

_________________
If translation=Error: reply="Sorry, Im Spanish": Endif


Top
 Profile  
Reply with quote  
 Post subject: Re: COCOA quests?
PostPosted: Sat Feb 11, 2017 5:40 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 2937
Location: Netherlands
It helps if you explain what those windows api calls actually do.

On OSX you use CocoaMessage.
For example to close a window
Code:
CocoaMessage(0, WindowID(0), "close")

or to add a child window
Code:
CocoaMessage(0, WindowID(0), "addChildWindow:", WindowID(1), "ordered:", 1); NSWindowAbove = 1

_________________
MacOS 10.12, PB 5.51 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: COCOA quests?
PostPosted: Sat Feb 11, 2017 7:43 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jul 08, 2013 8:43 pm
Posts: 218
Wow! Thanks willbert!
Do you know how set position window?, some thing like setposition(hwnd,x,y,w,h)

_________________
If translation=Error: reply="Sorry, Im Spanish": Endif


Top
 Profile  
Reply with quote  
 Post subject: Re: COCOA quests?
PostPosted: Sat Feb 11, 2017 8:39 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 860
Location: Germany
minimy wrote:
Do you know how set position window?, some thing like setposition(hwnd,x,y,w,h)


Why not with native PB-Function ResizeWindow(...)

_________________
My Projects OOP-BaseClass / OOP-BaseClassDispatch / Event-Designer /
PB v3.30 / v5.60 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
 Post subject: Re: COCOA quests?
PostPosted: Mon Feb 13, 2017 8:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jul 08, 2013 8:43 pm
Posts: 218
mk-soft wrote:
minimy wrote:
Do you know how set position window?, some thing like setposition(hwnd,x,y,w,h)


Why not with native PB-Function ResizeWindow(...)


Hi mk-soft! because i need a window based in a handle not in windowid or window number. Is not a PBwindow.
Thanks for help.

_________________
If translation=Error: reply="Sorry, Im Spanish": Endif


Top
 Profile  
Reply with quote  
 Post subject: Re: COCOA quests?
PostPosted: Tue Feb 14, 2017 7:02 am 
Offline
PureBasic Expert
PureBasic Expert

Joined: Sun Aug 08, 2004 5:21 am
Posts: 2937
Location: Netherlands
minimy wrote:
Do you know how set position window?

Screen coordinates are flipped. (0, 0) is the bottom left of the screen.

Set bottom left coordinate of window
Code:
Point.NSPoint\x = 100
Point\y = 100
CocoaMessage(0, WindowID(0), "setFrameOrigin:@", @Point)


Set top left coordinate of window
Code:
Point.NSPoint\x = 100
Point\y = 100
CocoaMessage(0, WindowID(0), "setFrameTopLeftPoint:@", @Point)


Center window
Code:
CocoaMessage(0, WindowID(0), "center")

_________________
MacOS 10.12, PB 5.51 x64


Top
 Profile  
Reply with quote  
 Post subject: Re: COCOA quests?
PostPosted: Tue Feb 14, 2017 1:58 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Jul 08, 2013 8:43 pm
Posts: 218
Hi willbert! Fantastic! :shock: its exactly i need. :D
Thousend thanks to both for quick and perfect answer!

_________________
If translation=Error: reply="Sorry, Im Spanish": Endif


Top
 Profile  
Reply with quote  
 Post subject: Re: COCOA quests?
PostPosted: Tue Feb 14, 2017 9:49 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Apr 29, 2003 9:18 pm
Posts: 1443
Location: North by Northwest
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.

:mrgreen:

_________________

I am to provide the public with beneficial shocks.
Alfred Hitshock


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 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