Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Re: Cocoa: floating windows that float via declare? (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Re: Global Floating Windows
Next thread: Linux folderitem visible


Re: Cocoa: floating windows that float via declare?   -   Charles Yeomans
  Re: Cocoa: floating windows that float via declare?   -   Stéphane Mons <
  Re: Cocoa: floating windows that float via declare?   -   Stéphane Mons <
  Re: Cocoa: floating windows that float via declare?   -   Charles Yeomans
  Re: Cocoa: floating windows that float via declare?   -   Yevgeny Nikolaichik
  Re: Cocoa: floating windows that float via declare?   -   Arnaud Nicolet
  Re: Cocoa: floating windows that float via declare?   -   Stéphane Mons <
  Re: Cocoa: floating windows that float via declare?   -   Stéphane Mons <
  Re: Cocoa: floating windows that float via declare?   -   Charles Yeomans
  Re: Cocoa: floating windows that float via declare?   -   Arnaud Nicolet
  Re: Cocoa: floating windows that float via declare?   -   Tim Jones
  Re: Cocoa: floating windows that float via declare?   -   Stéphane Mons <
  Re: Cocoa: floating windows that float via declare?   -   Arnaud Nicolet
  Cocoa: floating windows that float via declare?   -   Yevgeny Nikolaichik

Re: Cocoa: floating windows that float via declare?
Date: 24.09.11 14:03 (Sat, 24 Sep 2011 09:03:12 -0400)
From: Charles Yeomans
On Sep 24, 2011, at 4:53 AM, Stéphane Mons wrote:

> In Example Projects/Mac OS X/Cocoa Declare and CocoaObject Example.rbp
>
>
> Le 23 sept. 2011 à 22:10, Charles Yeomans a écrit :
>
>> On Sep 23, 2011, at 1:16 PM, Stéphane Mons wrote:
>>
>>> My mistake. For the boolean value being passed as an integer, I only followed the RS Cocoa Declares sample code.
>>>
>>> Le 23 sept. 2011 à 18:30, Charles Yeomans a écrit :
>>>
>>>> Here is the Objective-C prototype of setBecomesKeyOnlyIfNeeded:.
>>>>
>>>> - (void)setBecomesKeyOnlyIfNeeded:(BOOL)becomesKeyOnlyIfNeeded
>>>>
>>>> A correct REALbasic declaration is this:
>>>>
>>>> declare sub SetBecomesKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, becomesKeyOnlyIfNeeded as Boolean)
>>>>
>>>> Since setBecomesKeyOnlyIfNeeded: returns a void; that is to say, nothing, there isn't any point to declaring it in REALbasic as a function. The argument becomesKeyOnlyIfNeeded is of type BOOL; in Objective-C, BOOL is a signed char and so one byte. Your declaration works only because of the representation of little-endian integers.
>>
>> Where is this sample code?

I found it; thanks. It needs to be rewritten.

Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 24.09.11 10:05 (Sat, 24 Sep 2011 11:05:22 +0200)
From: Stéphane Mons <
I think it is a bug because this behavior only affects "emulated" controls, not native controls : BevelButtons, Canvases, ListBoxes…

Le 23 sept. 2011 à 21:51, Yevgeny Nikolaichik a écrit :

> Thanks everyone for the suggestions, but I've tried SetBecomeKeyOnlyIfNeeded already and it didn't help. I've put up a quick project
> (http://dl.dropbox.com/u/13884297/FloatingWinTest.zip)
> to illustrate the issue. The project contains two windows: the main and the floating one. The top of the floating window is occupied by a listbox and there's a canvas in the bottom. You'll need to click twice to select a cell in the listbox or to get mousedown event in the canvas. If SetBecomeKeyOnlyIfNeeded is called, the listbox and the canvas don't react to single mouse clicks at all which is definitely not what I want.
>
> (And, of course, the floating window behaves properly in Carbon and in win32)
>
> Yevgeny
>
> PS I don't think this is a bug, as it's probably the normal behavior of NSpanel. The question is how to change it…

5 REM My Signature
10 PRINT "Stéphane"
20 GOTO 10



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 24.09.11 09:53 (Sat, 24 Sep 2011 10:53:20 +0200)
From: Stéphane Mons <
In Example Projects/Mac OS X/Cocoa Declare and CocoaObject Example.rbp

Le 23 sept. 2011 à 22:10, Charles Yeomans a écrit :

> On Sep 23, 2011, at 1:16 PM, Stéphane Mons wrote:
>
>> My mistake. For the boolean value being passed as an integer, I only followed the RS Cocoa Declares sample code.
>>
>> Le 23 sept. 2011 à 18:30, Charles Yeomans a écrit :
>>
>>> Here is the Objective-C prototype of setBecomesKeyOnlyIfNeeded:.
>>>
>>> - (void)setBecomesKeyOnlyIfNeeded:(BOOL)becomesKeyOnlyIfNeeded
>>>
>>> A correct REALbasic declaration is this:
>>>
>>> declare sub SetBecomesKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, becomesKeyOnlyIfNeeded as Boolean)
>>>
>>> Since setBecomesKeyOnlyIfNeeded: returns a void; that is to say, nothing, there isn't any point to declaring it in REALbasic as a function. The argument becomesKeyOnlyIfNeeded is of type BOOL; in Objective-C, BOOL is a signed char and so one byte. Your declaration works only because of the representation of little-endian integers.
>
> Where is this sample code?

5 REM My Signature
10 PRINT "Stéphane"
20 GOTO 10



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 21:10 (Fri, 23 Sep 2011 16:10:08 -0400)
From: Charles Yeomans

On Sep 23, 2011, at 1:16 PM, Stéphane Mons wrote:

> My mistake. For the boolean value being passed as an integer, I only followed the RS Cocoa Declares sample code.
>
> Le 23 sept. 2011 à 18:30, Charles Yeomans a écrit :
>
>> On Sep 23, 2011, at 11:43 AM, Stéphane Mons wrote:
>>
>>> MacProcID is for Carbon only.
>>>
>>> However, setBecomesKeyOnlyIfNeeded works for me with RS 2011r3
>>>
>>> In the Open event of the floating window, I added:
>>> soft declare function SetBecomeKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, YesNo as integer) as integer
>>>
>>> dim OK as integer
>>>
>>> OK = SetBecomeKeyOnlyIfNeeded( self.Handle, 1 )
>>>
>>> Then the floating window activates only for TextFields. Note that BevelButtons do not work but PushButtons do.
>>
>>
>> Here is the Objective-C prototype of setBecomesKeyOnlyIfNeeded:.
>>
>> - (void)setBecomesKeyOnlyIfNeeded:(BOOL)becomesKeyOnlyIfNeeded
>>
>> A correct REALbasic declaration is this:
>>
>> declare sub SetBecomesKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, becomesKeyOnlyIfNeeded as Boolean)
>>
>> Since setBecomesKeyOnlyIfNeeded: returns a void; that is to say, nothing, there isn't any point to declaring it in REALbasic as a function. The argument becomesKeyOnlyIfNeeded is of type BOOL; in Objective-C, BOOL is a signed char and so one byte. Your declaration works only because of the representation of little-endian integers.

Where is this sample code?

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 20:51 (Fri, 23 Sep 2011 22:51:47 +0300)
From: Yevgeny Nikolaichik
Thanks everyone for the suggestions, but I've tried SetBecomeKeyOnlyIfNeeded already and it didn't help. I've put up a quick project
(http://dl.dropbox.com/u/13884297/FloatingWinTest.zip)
to illustrate the issue. The project contains two windows: the main and the floating one. The top of the floating window is occupied by a listbox and there's a canvas in the bottom. You'll need to click twice to select a cell in the listbox or to get mousedown event in the canvas. If SetBecomeKeyOnlyIfNeeded is called, the listbox and the canvas don't react to single mouse clicks at all which is definitely not what I want.

(And, of course, the floating window behaves properly in Carbon and in win32)

Yevgeny

PS I don't think this is a bug, as it's probably the normal behavior of NSpanel. The question is how to change it...

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 18:26 (Fri, 23 Sep 2011 19:26:27 +0200)
From: Arnaud Nicolet
Le 23 sept. 11 à 19:12, Stéphane Mons a écrit:

> Basically yes. In Carbon, it was impossible to change window
> attributes on-the-fly, hence the ProcID, but Cocoa allows many more
> changes so the options are defined as simple properties (more or
> less) of the NSWindow object. However, a floating palette is usually
> defined as an NSPanel (a subclass of NSWindow) which has some
> different default values for some properties.

Thanks. Cocoa is another world for which some don't have an UFO ;-)
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 18:16 (Fri, 23 Sep 2011 19:16:08 +0200)
From: Stéphane Mons <
My mistake. For the boolean value being passed as an integer, I only followed the RS Cocoa Declares sample code.

Le 23 sept. 2011 à 18:30, Charles Yeomans a écrit :

> On Sep 23, 2011, at 11:43 AM, Stéphane Mons wrote:
>
>> MacProcID is for Carbon only.
>>
>> However, setBecomesKeyOnlyIfNeeded works for me with RS 2011r3
>>
>> In the Open event of the floating window, I added:
>> soft declare function SetBecomeKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, YesNo as integer) as integer
>>
>> dim OK as integer
>>
>> OK = SetBecomeKeyOnlyIfNeeded( self.Handle, 1 )
>>
>> Then the floating window activates only for TextFields. Note that BevelButtons do not work but PushButtons do.
>
>
> Here is the Objective-C prototype of setBecomesKeyOnlyIfNeeded:.
>
> - (void)setBecomesKeyOnlyIfNeeded:(BOOL)becomesKeyOnlyIfNeeded
>
> A correct REALbasic declaration is this:
>
> declare sub SetBecomesKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, becomesKeyOnlyIfNeeded as Boolean)
>
> Since setBecomesKeyOnlyIfNeeded: returns a void; that is to say, nothing, there isn't any point to declaring it in REALbasic as a function. The argument becomesKeyOnlyIfNeeded is of type BOOL; in Objective-C, BOOL is a signed char and so one byte. Your declaration works only because of the representation of little-endian integers.

5 REM My Signature
10 PRINT "Stéphane"
20 GOTO 10



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 18:12 (Fri, 23 Sep 2011 19:12:33 +0200)
From: Stéphane Mons <
Basically yes. In Carbon, it was impossible to change window attributes on-the-fly, hence the ProcID, but Cocoa allows many more changes so the options are defined as simple properties (more or less) of the NSWindow object. However, a floating palette is usually defined as an NSPanel (a subclass of NSWindow) which has some different default values for some properties.

Le 23 sept. 2011 à 18:03, Arnaud Nicolet a écrit :

> Le 23 sept. 11 à 17:43, Stéphane Mons a écrit:
>
>> MacProcID is for Carbon only.
>
> That information is certainly lacking in the documentation.
> Does that mean Cocoa has only "standard window definitions" (in RS, the frame property)?

5 REM My Signature
10 PRINT "Stéphane"
20 GOTO 10



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 17:30 (Fri, 23 Sep 2011 12:30:02 -0400)
From: Charles Yeomans

On Sep 23, 2011, at 11:43 AM, Stéphane Mons wrote:

> MacProcID is for Carbon only.
>
> However, setBecomesKeyOnlyIfNeeded works for me with RS 2011r3
>
> In the Open event of the floating window, I added:
> soft declare function SetBecomeKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, YesNo as integer) as integer
>
> dim OK as integer
>
> OK = SetBecomeKeyOnlyIfNeeded( self.Handle, 1 )
>
> Then the floating window activates only for TextFields. Note that BevelButtons do not work but PushButtons do.


Here is the Objective-C prototype of setBecomesKeyOnlyIfNeeded:.

- (void)setBecomesKeyOnlyIfNeeded:(BOOL)becomesKeyOnlyIfNeeded

A correct REALbasic declaration is this:

declare sub SetBecomesKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, becomesKeyOnlyIfNeeded as Boolean)

Since setBecomesKeyOnlyIfNeeded: returns a void; that is to say, nothing, there isn't any point to declaring it in REALbasic as a function. The argument becomesKeyOnlyIfNeeded is of type BOOL; in Objective-C, BOOL is a signed char and so one byte. Your declaration works only because of the representation of little-endian integers.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 17:03 (Fri, 23 Sep 2011 18:03:49 +0200)
From: Arnaud Nicolet
Le 23 sept. 11 à 17:43, Stéphane Mons a écrit:

> MacProcID is for Carbon only.

That information is certainly lacking in the documentation.
Does that mean Cocoa has only "standard window definitions" (in RS,
the frame property)?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 16:55 (Fri, 23 Sep 2011 08:55:47 -0700)
From: Tim Jones
On Sep 23, 2011, at 7:21 AM, Yevgeny Nikolaichik wrote:

> Hi,
>
> I've got this Cocoa problem: controls in floating windows (e.g. Canvas, Listbox) don't react to mouse clicks until the floating window is activated itself. So, interaction with canvas-based controls or selecting anything in a listbox requires two mouse clicks (and then an extra click is required to activate the main window). So, making a floating tool palette seems impossible in REAL Studio when compiling for Cocoa (no problem for Carbon and Win32).
>
> Hence the question: is there any way to persuade floating windows in Cocoa to accept mouse clicks without activating the floating window and inactivating the main one?

Hi Yevgeny,

This sounds like a bug. I would recommend that you use the Feedback app and report it and include a sample so the RS team can track it down.

Tim

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 16:43 (Fri, 23 Sep 2011 17:43:42 +0200)
From: Stéphane Mons <
MacProcID is for Carbon only.

However, setBecomesKeyOnlyIfNeeded works for me with RS 2011r3

In the Open event of the floating window, I added:
soft declare function SetBecomeKeyOnlyIfNeeded lib "Cocoa" selector "setBecomesKeyOnlyIfNeeded:" (win as integer, YesNo as integer) as integer

dim OK as integer

OK = SetBecomeKeyOnlyIfNeeded( self.Handle, 1 )

Then the floating window activates only for TextFields. Note that BevelButtons do not work but PushButtons do.

Le 23 sept. 2011 à 16:41, Arnaud Nicolet a écrit :

> Le 23 sept. 11 à 16:21, Yevgeny Nikolaichik a écrit:
>
>> I've got this Cocoa problem: controls in floating windows (e.g. Canvas, Listbox) don't react to mouse clicks until the floating window is activated itself. So, interaction with canvas-based controls or selecting anything in a listbox requires two mouse clicks (and then an extra click is required to activate the main window). So, making a floating tool palette seems impossible in REAL Studio when compiling for Cocoa (no problem for Carbon and Win32).
>>
>> Hence the question: is there any way to persuade floating windows in Cocoa to accept mouse clicks without activating the floating window and inactivating the main one?
>>
>> I have looked through Apple's documentation (which I'm far from understanding) and tried without much success declares with several functions that seemed to be relevant, including
>> setBecomesKeyOnlyIfNeeded:
>> setLevel:
>> setStyleMask: (with combinations involving NSUtilityWindowMask and NSNonactivatingPanelMask)
>>
>> I guess I'm just looking in the wrong direction. I'd be grateful for any advice on the matter.
>
> I was about to suggest you something that does not work for me, but perhaps it would work for you if you have a "better" RS version.
> In Carbon builds, you can use a MacProcID of 1071 to have a floating window. One problem is that MacProcID seems to be broken on the Cocoa builds (at least, setting a MacProcID doesn't do anything in my RS version on Cocoa). Perhaps your version has a MacProcID not broken in Cocoa and you could try?
> (MacProcID are said to be supported on the Mac platform. I assume it means it should work on Cocoa).

5 REM My Signature
10 PRINT "Stéphane"
20 GOTO 10



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Cocoa: floating windows that float via declare?
Date: 23.09.11 15:41 (Fri, 23 Sep 2011 16:41:44 +0200)
From: Arnaud Nicolet
Le 23 sept. 11 à 16:21, Yevgeny Nikolaichik a écrit:

> I've got this Cocoa problem: controls in floating windows (e.g.
> Canvas, Listbox) don't react to mouse clicks until the floating
> window is activated itself. So, interaction with canvas-based
> controls or selecting anything in a listbox requires two mouse
> clicks (and then an extra click is required to activate the main
> window). So, making a floating tool palette seems impossible in REAL
> Studio when compiling for Cocoa (no problem for Carbon and Win32).
>
> Hence the question: is there any way to persuade floating windows in
> Cocoa to accept mouse clicks without activating the floating window
> and inactivating the main one?
>
> I have looked through Apple's documentation (which I'm far from
> understanding) and tried without much success declares with several
> functions that seemed to be relevant, including
> setBecomesKeyOnlyIfNeeded:
> setLevel:
> setStyleMask: (with combinations involving NSUtilityWindowMask and
> NSNonactivatingPanelMask)
>
> I guess I'm just looking in the wrong direction. I'd be grateful for
> any advice on the matter.

I was about to suggest you something that does not work for me, but
perhaps it would work for you if you have a "better" RS version.
In Carbon builds, you can use a MacProcID of 1071 to have a floating
window. One problem is that MacProcID seems to be broken on the Cocoa
builds (at least, setting a MacProcID doesn't do anything in my RS
version on Cocoa). Perhaps your version has a MacProcID not broken in
Cocoa and you could try?
(MacProcID are said to be supported on the Mac platform. I assume it
means it should work on Cocoa).
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Cocoa: floating windows that float via declare?
Date: 23.09.11 15:21 (Fri, 23 Sep 2011 17:21:02 +0300)
From: Yevgeny Nikolaichik
Hi,

I've got this Cocoa problem: controls in floating windows (e.g. Canvas, Listbox) don't react to mouse clicks until the floating window is activated itself. So, interaction with canvas-based controls or selecting anything in a listbox requires two mouse clicks (and then an extra click is required to activate the main window). So, making a floating tool palette seems impossible in REAL Studio when compiling for Cocoa (no problem for Carbon and Win32).

Hence the question: is there any way to persuade floating windows in Cocoa to accept mouse clicks without activating the floating window and inactivating the main one?

I have looked through Apple's documentation (which I'm far from understanding) and tried without much success declares with several functions that seemed to be relevant, including
setBecomesKeyOnlyIfNeeded:
setLevel:
setStyleMask: (with combinations involving NSUtilityWindowMask and NSNonactivatingPanelMask)

I guess I'm just looking in the wrong direction. I'd be grateful for any advice on the matter.

Yevgeny
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>