Old 03-24-2019, 07:28 AM   #1
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default how to get project window height?

Hi! i would like to get the height of project window. Is this possible?

Thank you!
deeb is offline   Reply With Quote
Old 03-24-2019, 11:34 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Maybe check this thread : https://forum.cockos.com/showthread.php?t=206711
X-Raym is offline   Reply With Quote
Old 03-24-2019, 01:43 PM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

You can try the FindChildByID(from the JS-extension) function on GetMainHWND().
Just iterate through the first ten thousand ids and try to find the hwnd that has the title "trackview". Works on Windows.
This id can then be used to get the ArrangeviewHwnd on all platforms, which isn't possible vy title.

Or you use my API, which has GetArrangeHwnd for that.


I'm currently documenting the available id's for FindChildByID, so these things will be easier in the future.
Haven't got my notes right here, or I could give you the right ID...

Edit: this is the function from my API
https://mespotin.uber.space/Ultrasch...iewAndTimeLine
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 03-24-2019 at 01:57 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-24-2019, 03:06 PM   #4
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by deeb View Post
Hi! i would like to get the height of project window. Is this possible?
Wouldn't that be the same height as the arrange view client height?

Code:
function GetBounds(hwnd)
  ret, left, top, right, bottom = reaper.JS_Window_GetClientRect(hwnd)
  return left, top, right-left, bottom-top
end

main = reaper.GetMainHwnd()
arrange = reaper.JS_Window_FindChildByID(main, 1000)
x,y,w,h = GetBounds(arrange)

reaper.ShowConsoleMsg("Height = " .. tostring(h) .. "\n")
Edgemeal is offline   Reply With Quote
Old 03-24-2019, 10:21 PM   #5
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

Thank you so much All! X-Raym, mespotine, Edgemeal! this forum is something!
At the end i used Edgemeal recipe and worked , very very very nice : )
Again Thank you so much!
deeb is offline   Reply With Quote
Old 03-25-2019, 01:54 AM   #6
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Note the 1000 (or 3E8 in hex) is the Control ID for the ArrangeView window. If you place the mouse pointer over a top-level window and run this script you'll get the windows control ID in hex,...

Code:
local x,y = reaper.GetMousePosition()
local hwnd = reaper.JS_Window_FromPoint(x,y)
local id = reaper.JS_Window_GetLongPtr(hwnd, "ID")
reaper.ShowConsoleMsg(tostring(id) .. "\n")
For anything deeper then top-level windows I use MS SPY++.
Have fun!
Edgemeal is offline   Reply With Quote
Old 03-25-2019, 07:28 AM   #7
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

Thank you very much for the nice tips!
Have fun too
deeb 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 01:32 AM.


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