[Q] Window pointer

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

pthirkell
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 93
Joined: Tue Nov 17, 2009 6:47 pm
Location: Wellington, New Zealand

Re: [Q] Window pointer

Post by pthirkell » Tue Nov 28, 2017 7:56 am

Could you create as a library rather than a widget?

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: [Q] Window pointer

Post by shaosean » Tue Nov 28, 2017 8:14 am

The NSWindow pointer is the location of the window (in memory) and is required to be able to run any of the NSWindow commands..

The full screen feature will take your window and make it full screen and move it to it's own virtual desktop (depending on the version of macOS you are using, it's either the double arrows in the top right corner of the window or the green button in the top left corner of the window)

This looks like either the windowID isn't the windowNumber, or the windowFromWindowNumber isn't returning the proper result (apparently it can return 0 in some cases depending on how the window was created)..

Perhaps time to do a feature request for a Handle/Pointer property so we can have access to the window pointer, regardless of the OS, so we have a method to get the handle in a LCB library.. Widgets already have a method, but require the widget to be embedded on a stack which doesn't really work for a library as it's not embedded on a stack..

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 192
Joined: Thu Apr 18, 2013 2:48 pm

Re: [Q] Window pointer

Post by livecodeali » Fri Dec 01, 2017 9:37 pm

The problem with the code, I think, is that you are using Integer in the foreign handler definition for NSApplicationWindowWithWindowNumber

I have it working here as a library using CLong instead:

Code: Select all

private foreign handler NSApplicationWindowWithWindowNumber(in sharedApplication as ObjcId, in windowNumber as CLong) returns ObjcId binds to "objc:NSApplication.-windowWithWindowNumber:"

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: [Q] Window pointer

Post by shaosean » Sat Dec 02, 2017 9:27 am

Thanks.. I'll give that a try.. :)

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: [Q] Window pointer

Post by shaosean » Sat Dec 02, 2017 11:52 am

As you're well aware - it works! :D

Now time to get some code written..

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: [Q] Window pointer

Post by shaosean » Sat Dec 02, 2017 3:12 pm

It might not look like much, but it's a start.. System-based full screen mode.. :) I'll be making it available shortly.. I'm pretty excited about this..
Screen Shot 2017-12-02 at 09.08.50.png
Screen Shot 2017-12-02 at 09.08.50.png (7.96 KiB) Viewed 5699 times

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 192
Joined: Thu Apr 18, 2013 2:48 pm

Re: [Q] Window pointer

Post by livecodeali » Mon Dec 04, 2017 10:39 am

Great! It's really good to see this :-)

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: [Q] Window pointer

Post by shaosean » Mon Dec 04, 2017 11:54 am

I had fun making it..

Post Reply

Return to “LiveCode Builder”