Go Back   Cockos Incorporated Forums > REAPER Forums > ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum

Reply
 
Thread Tools Display Modes
Old 03-08-2019, 03:21 PM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default macOS Objective C: When is a HWND not isKindOfClass:[NSWindow class]?

I am trying out some code for Apple, using Objective-C.

AFAIK, I am supposed to check whether HWNDs are usable, using
Code:
if ([(id)hwnd isKindOfClass:[NSWindow class]])
However, this seems to always return false, even for standard REAPER windows such as the MIDI editor, returned by MIDIEditor_GetActive.
juliansader is offline   Reply With Quote
Old 03-09-2019, 05:11 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,628
Default

I don't know, if that helps, but as far as I could see, no hwnd on the mac-version of Reaper has a class-name available using JS_Window_GetClassName.
So maybe, it isn't available that way on Mac.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 08-08-2019, 07:19 AM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

To answer my own question, as far as I understand it: the child HWNDs inside a top-level parent window are of class NSView, and only the parent is the NSWindow. (And the ContentView is the highest accessible NSView object in the window’s view hierarchy.)

Some functions, such as setting opacity, only apply to NSWindows, so to get the NSWindow that contains the NSView (corresponding to a WDL/swell HWND), one can use:
Code:
NSView* view = (NSView*)hwnd;
NSWindow* window = (NSWindow*)[view window];
juliansader is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.