Old 10-14-2018, 08:38 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,827
Default gfx.init returns HWND for script GUI

Several API functions that are applicable to script GUIs require window HWNDs, particularly the docking functions such as DockWindowAdd.

gfx.init currently only returns some undocumented integer value. It would be more helpful if gfx.init could instead return the HWND of the newly created GUI. (A nil or 0 return HWND could indicate failure.)
juliansader is online now   Reply With Quote
Old 10-15-2018, 08:44 AM   #2
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,679
Default

+1

this is very much needed.
With your extension, we could only get the HWND, if all gfx.init-windows currently opened have different names, so it would be really helpful to have the right HWND as well.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is online now   Reply With Quote
Old 11-17-2019, 01:35 PM   #3
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,573
Default

Would be very important: https://forum.cockos.com/showpost.ph...&postcount=796

+1
spk77 is offline   Reply With Quote
Old 11-17-2019, 02:38 PM   #4
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 304
Default

Would also be cool if gfx.init were recoded to deprecate gfx.dock

In an ideal world you could return the following values with an input of '0' and an hwnd:
name, x, y, w, h, d, window_style = gfx.init( 0, hwnd )
But to set:
hwnd = gfx.init( name, x, y, w, h, d, window_style)
If this were coupled with the newest behaviour of gfx.init, where supplying "" as name sets values to the script's gfx window instead of re-initializing, I think that would be great.

Also, dock should be numbered 0-4 instead of 0-1.

0 - undocked
1 - docked left
2 - docked top
3 - docked right
4 - docked bottom

Last edited by Dafarkias; 11-17-2019 at 02:50 PM.
Dafarkias is offline   Reply With Quote
Old 11-17-2019, 03:06 PM   #5
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,420
Default

Isn't dockstate entirely dependent on how the user has their dockers set up? It's not just "is docked" and "is not docked".
Lokasenna is online now   Reply With Quote
Old 11-17-2019, 03:25 PM   #6
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,573
Default

Quote:
Originally Posted by Lokasenna View Post
Isn't dockstate entirely dependent on how the user has their dockers set up? It's not just "is docked" and "is not docked".
Docker IDs seem to be dynamic somehow...
It would be nice to have a function to get the closest docker's ID from a point (x, y)

Then it would be easier to implement something like this (drag and drop to dock script windows):
https://forum.cockos.com/showpost.ph...03&postcount=2
spk77 is offline   Reply With Quote
Old 11-18-2019, 02:11 PM   #7
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 304
Default

Couldn't the dock states be specified by location, though?

If you could set docks to screen position and then resize using gfx.w & gfx.h, you could write a script that allows REAPER to remember the docking positions of unique windows. Or it could be integrated natively, ideally.

I mean of course, ignoring the blatantly obvious conclusion that it would cause a horrendous inconvenience to Schwa and J in the unlikely event they decide to code such a change.
Dafarkias is offline   Reply With Quote
Old 11-19-2019, 09:10 AM   #8
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,679
Default

I made a request on docker-related functions here:
https://forum.cockos.com/showthread.php?t=222314

I also described, how the dockers seem to work over there.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is online now   Reply With Quote
Old 11-19-2019, 09:55 AM   #9
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: England
Posts: 304
Default

I didn't mention docking originally to try and de-rail the thread, it just kinda popped into my head, think it could also be integrated into gfx.init.

My apologies.

I believe, if I'm not mistaken, there's another related feature request out-and-about somewhere, something to do with docker positions for unique windows being 'remembered' by REAPER.
Dafarkias 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:10 PM.


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