Old 07-31-2019, 09:08 AM   #641
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Is there a way to make a window in Reaper full-screen? Would love to have a way to make the gfx-window fullscreen or maybe the FX-Chain one in some usecases.
__________________
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 07-31-2019, 10:00 AM   #642
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by mespotine View Post
Is there a way to make a window in Reaper full-screen? Would love to have a way to make the gfx-window fullscreen or maybe the FX-Chain one in some usecases.
Have you tried sending maximize window message,.. (hwnd, "WM_SYSCOMMAND", 0xF030, 0,0,0), posted on reapack,..

Maximize foreground window
https://raw.githubusercontent.com/Re...d%20window.lua

Restore foreground window
https://github.com/ReaTeam/ReaScript...d%20window.lua

EDIT,
Theres also the ShowWindow function, https://docs.microsoft.com/en-us/win...ser-showwindow
Code:
reaper.BR_Win32_ShowWindow(hwnd, cmdShow)

Last edited by Edgemeal; 07-31-2019 at 11:13 AM.
Edgemeal is offline   Reply With Quote
Old 07-31-2019, 11:59 AM   #643
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,110
Default

Quote:
Originally Posted by Edgemeal View Post
posted on reapack,..
Works also with a floating docker.
Cool, thanks.
nofish is offline   Reply With Quote
Old 08-02-2019, 08:52 AM   #644
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Quote:
Originally Posted by Edgemeal View Post
Have you tried sending maximize window message,.. (hwnd, "WM_SYSCOMMAND", 0xF030, 0,0,0), posted on reapack,..

Maximize foreground window
https://raw.githubusercontent.com/Re...d%20window.lua

Restore foreground window
https://github.com/ReaTeam/ReaScript...d%20window.lua

EDIT,
Theres also the ShowWindow function, https://docs.microsoft.com/en-us/win...ser-showwindow
Code:
reaper.BR_Win32_ShowWindow(hwnd, cmdShow)
Thanx! Will look into that
__________________
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-05-2019, 02:28 PM   #645
AndrewFalcon
Human being with feelings
 
AndrewFalcon's Avatar
 
Join Date: Dec 2018
Posts: 39
Default

Quote:
Originally Posted by juliansader View Post
You don't need to convert the returned handle to an address, and can compare the handles directly.
These handles are not stable, so you should load them at least once per REAPER session (or once each time that the script is run).
Julian please can you explain how to use reaper.JS_Mouse_GetCursor()? Numbers change every session.
It can be better and more detailed replacement for BR_GetMouseCursorContext()
May be load handles when JS_API starting?Inside JS_API . And return stable handles.To facilitate use commoners))
AndrewFalcon is offline   Reply With Quote
Old 08-05-2019, 02:37 PM   #646
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
Default

Quote:
Originally Posted by AndrewFalcon View Post
Julian please can you explain how to use reaper.JS_Mouse_GetCursor()? Numbers change every session.
It can be better and more detailed replacement for BR_GetMouseCursorContext()
May be load handles when JS_API starting?Inside JS_API . And return stable handles.To facilitate use commoners))
Code:
local reaper_cursors =  {
                          {187,"MOVE"},  -- MOVE
                          {185,"DRAW"},  -- DRAW
                          {417,"EDGE L"},  -- LEFT EDGE
                          {418,"EDGE R"},  -- RIGHT EDGE
                          {184,"FADE L"},  -- FADE RIGHT
                          {105,"FADE R"},   -- FADE LEFT
                        }

function project_mouse_info()
    local cur_cursor = reaper.JS_Mouse_GetCursor()
    for i = 1, #reaper_cursors do
        local cursor = reaper.JS_Mouse_LoadCursor( reaper_cursors[i][1] )
        if cur_cursor == cursor then
          return reaper_cursors[i][2]
        end
    end
end
You can extract them via resource hacker

Quote:
Originally Posted by AndrewFalcon View Post
It can be better and more detailed replacement for BR_GetMouseCursorContext()
That was the general idea

Last edited by Sexan; 08-05-2019 at 02:43 PM.
Sexan is offline   Reply With Quote
Old 08-05-2019, 03:09 PM   #647
AndrewFalcon
Human being with feelings
 
AndrewFalcon's Avatar
 
Join Date: Dec 2018
Posts: 39
Default

Thank you Sexan!Understand now if you use custom cursors you get nil from this function.I get only FADEs because they reaper original

Last edited by AndrewFalcon; 08-05-2019 at 03:17 PM.
AndrewFalcon is offline   Reply With Quote
Old 08-05-2019, 03:17 PM   #648
Sexan
Human being with feelings
 
Sexan's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 4,691
Default

well call project_mouse_info() in your main function and when you get the value make it do something:

Code:
function main()
 cur = project_mouse_info()
 if cur == "FADE L" then
 -- do some voodoo here
 end
end
I only populated few cursors since I'm testing stuff. but you can use resource hacker to see all cursors and their ID
It works excellent as far as I've tested (tracking if you are on envelope point,item fade,edge ....)
EDIT: I did not test it with custom cursors yet
Sexan is offline   Reply With Quote
Old 08-08-2019, 09:21 AM   #649
Reno.thestraws
Human being with feelings
 
Reno.thestraws's Avatar
 
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
Default

Hello

I have a big problem with the update version of Reascript API functions for Reascrpits

If I use version 0.989, the following script don't work

Code:
-- USER CONFIG AREA --

W_action_id = "_S&M_CYCLACTION_12" -- Main Tool
W_section = "Main"

-----

Wkey = 0x57 -- W -- https://docs.microsoft.com/en-us/windows/desktop/inputdev/virtual-key-codes

----------------------

-- Globals
armed, section = reaper.GetArmedCommand()
 if armed == action_id then
 toggle_state = 1
 else
 toggle_state = 0 
end
-- Set ToolBar Button State
function SetButtonState( set )
  if not set then set = 0 end
  local is_new_value, filename, sec, cmd, mode, resolution, val = reaper.get_action_context()
  local state = reaper.GetToggleCommandStateEx( sec, cmd )
  reaper.SetToggleCommandState( sec, cmd, set ) -- Set ON
  reaper.RefreshToolbar2( sec, cmd )
end
  
-- Main Function (which loop in background)
function main()

  retval, state = reaper.JS_VKeys_GetState()
  window, seg, detail= reaper.BR_GetMouseCursorContext()
  

-- W Key
  if state:byte(Wkey) ~= 0 then
    if toggle_state == 0 and window ~= "tcp"  then
      reaper.ArmCommand( reaper.NamedCommandLookup(W_action_id), W_section )
      reaper.UpdateArrange()
      toggle_state = 1
    end
-- W key
  else
    if toggle_state == 1 and window ~= "tcp"  then
      reaper.ArmCommand(0, "Main")
      reaper.UpdateArrange()
      toggle_state = 0
    end
  end
  
  reaper.defer( main )
  
end

-- RUN
if not reaper.JS_VKeys_GetState then
  reaper.ShowConsoleMsg('Please Install js_ReaScriptAPI extension.\nhttps://forum.cockos.com/showthread.php?t=212174\n')
else
  reaper.ClearConsole()
  SetButtonState( 1 )
  main()
  reaper.atexit( SetButtonState )
end
Red line is buggy

With version 0.980, everything work as expected

Any idea?

Thanks in advance
__________________
http://www.residenceemilia.com
Reno.thestraws is offline   Reply With Quote
Old 08-08-2019, 09:34 AM   #650
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

What is the bug that you see in the red line when you run the script?

(BTW, are you perhaps using a recent dev version of REAPER? BR_GetMouseCursorContext is temporarily broken in the dev versions, and you need to download SWS from landoleet.)
juliansader is offline   Reply With Quote
Old 08-08-2019, 09:44 AM   #651
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by AndrewFalcon View Post
Julian please can you explain how to use reaper.JS_Mouse_GetCursor()? Numbers change every session.
It can be better and more detailed replacement for BR_GetMouseCursorContext()
May be load handles when JS_API starting?Inside JS_API . And return stable handles.To facilitate use commoners))
JS_Mouse_GetCursor is an interface to the Win32 function GetCursor, and a good place to start is MS's documentation for the function. The returned value is a handle created by the operating system, so it unfortunately it will likely change every session.

For help on using Resource Hacker, check out the thread WDL/SWELL and C++ extensions: How to change mouse cursor?.
juliansader is offline   Reply With Quote
Old 08-08-2019, 10:08 AM   #652
Reno.thestraws
Human being with feelings
 
Reno.thestraws's Avatar
 
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
Default

@Julian

I use last officiel version pc both reaper and sws

In the same config, same version, pc, everything, the script work with your api extension v0.980. If I switch to 0.989 via reapack, script don't work anymore

switch back to 0.980 and it work again

the script is base on continuous key.

in short, the script is a defer waiting for the W key to be pressed. If the key is pressed, then it execute a cycle action
__________________
http://www.residenceemilia.com
Reno.thestraws is offline   Reply With Quote
Old 08-08-2019, 10:09 AM   #653
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Quote:
Originally Posted by Reno.thestraws View Post
Red line is buggy
With version 0.980, everything work as expected
IIRC in early JS versions VKeys_GetState didn't require any params, but then he added a cutoffTime param, so now if I don't enter a value (like 0.1) VKeys_GetState will error.

test,
Code:
function main() -- testing REAPER v5.981+dev0807/x64, JS v0.989
  state = reaper.JS_VKeys_GetState(0.1)
  if state:byte(0x57) ~= 0 then msg('W key') end 
  reaper.defer(main)
end
main()
@ juliansader,
JS_VKeys_GetState should probably raise an error if cutoffTime param is not set.
Or are we using it wrong?

Last edited by Edgemeal; 08-08-2019 at 10:49 AM.
Edgemeal is offline   Reply With Quote
Old 08-08-2019, 10:30 AM   #654
Reno.thestraws
Human being with feelings
 
Reno.thestraws's Avatar
 
Join Date: Nov 2009
Location: Belgium
Posts: 10,474
Default

@edgemeal

Thanks a milion

you nailed it

state = reaper.JS_VKeys_GetState(0.1)

instead of

retvalue, state = reaper.JS_VKeys_GetState()
__________________
http://www.residenceemilia.com
Reno.thestraws is offline   Reply With Quote
Old 08-09-2019, 04:52 AM   #655
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,902
Default

Hi,


Is it possible to populate a search field with a string ?


I suppose I could just enter several keyword event but that seems overkill (and a bit hard to code as all character have to be converted to a certain key :P)


Thx !
X-Raym is offline   Reply With Quote
Old 08-09-2019, 06:12 AM   #656
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

If you are on Windows, you can send a pointer to the string via a window message as described in this post above.

Sending a string requires a bit of a workaround to recreate the Lua string in memory, so I would have liked to add an optional string parameter to the window messaging functions, but optional string parameters are still buggy.
juliansader is offline   Reply With Quote
Old 08-09-2019, 06:15 AM   #657
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Try JS_Window_SetTitle. If that fails, you can also add a mouseclickevent into the searcharea-hwnd. That often triggers Reaper to accept changes done by scripts.

Would be my naive approach.
__________________
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-09-2019, 07:20 AM   #658
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,902
Default

Thanks you both :P


mespotine JS_Window_SetTitle trick work in my case (media explorer search field) so as it is cross-platform and only one line to use, I'll for it ! :P
X-Raym is offline   Reply With Quote
Old 08-09-2019, 09:32 AM   #659
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

v0.990 uploaded:
* Fix: JS_Window_SetOpacity works on macOS. (Finally figured this one out!)
* New: JS_Window_Create. (Including transparent frameless windows!)
* New: JS_ListView_EnsureVisible.
* New: More options for Window_Show.
* New: JS_Window_SetZOrder options work on macOS. (Bit of a hack to replace the WDL/swell functions.)

EDIT: Here is an example of a frameless and a default framed window on Linux, both animated:

Last edited by juliansader; 08-09-2019 at 01:51 PM.
juliansader is offline   Reply With Quote
Old 08-09-2019, 10:57 AM   #660
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
Default

Wow, awesome, thanks Julian!

Quote:
* New: More options for Window_Show
Are they documented somewhere?
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 08-09-2019, 12:11 PM   #661
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by _Stevie_ View Post
Are they documented somewhere?
In the ReaScript help:
Quote:
"Sets the specified window's show state.

Parameters:
* state: One of the following options: "SHOW", "SHOWNA", "SHOWMINIMIZED", "HIDE", "SHOWNOACTIVATE", "NORMAL", "SHOWNORMAL", "SHOWMAXIMIZED", "SHOWDEFAULT" or "RESTORE". On Linux and macOS, only the first four options are fully implemented.
and MS's documentation for ShowWindow.


Quote:
Originally Posted by Edgemeal View Post
EDIT,
Theres also the ShowWindow function, https://docs.microsoft.com/en-us/win...ser-showwindow
Code:
reaper.BR_Win32_ShowWindow(hwnd, cmdShow)
Warning: WDL/swell on Linux/macOS uses different integers to represent these options than Win32 does on Windows, so if you use BR_Win32_ShowWindow, you must check which OS the script is running on, and use the numbers in swell-types.h if you are on Linux/macOS.

Last edited by juliansader; 08-09-2019 at 12:18 PM.
juliansader is offline   Reply With Quote
Old 08-10-2019, 08:25 AM   #662
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
Default

Quote:
Originally Posted by juliansader View Post
In the ReaScript help:
Awesome, didn't know that this is the first place to look, thanks!


Btw, this can't be used to remove the frame/borders from an existing window, right?:
Quote:
* New: JS_Window_Create. (Including transparent frameless windows!)
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom

Last edited by _Stevie_; 08-10-2019 at 08:33 AM.
_Stevie_ is offline   Reply With Quote
Old 08-11-2019, 05:15 PM   #663
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,902
Default

is reaper.JS_Window_SetTitle supposed to support UTF-8 characters ?


These dont works in Media Explorer search field.
X-Raym is offline   Reply With Quote
Old 08-13-2019, 12:01 PM   #664
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Quote:
Originally Posted by X-Raym View Post
is reaper.JS_Window_SetTitle supposed to support UTF-8 characters ?


These dont works in Media Explorer search field.
Can you enter successfuly UTF-8 characters by keyboard and read them out with Lua?
__________________
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-13-2019, 12:54 PM   #665
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,902
Default

@mespotine
Hmm it works if UTF-8 characters are sampled from the search bar itself.



But not if injected from script:


Code:
function GetMediaExplorer()
  local title = reaper.JS_Localize("Media Explorer", "common")
  local arr = reaper.new_array({}, 1024)
  reaper.JS_Window_ArrayFind(title, true, arr)
  local adr = arr.table()
  for j = 1, #adr do
    local hwnd = reaper.JS_Window_HandleFromAddress(adr[j])
    -- verify window by checking if it also has a specific child.
    if reaper.JS_Window_FindChildByID(hwnd, 1045) then -- 1045:ID of volume control in media explorer.
      return hwnd
    end 
  end
end

function UpdateMediaExplorerSearch( str )

  hWnd = GetMediaExplorer()
  search = reaper.JS_Window_FindChildByID(hWnd, 1015) 
  
  if search then
    if not reaper.JS_Window_IsVisible(search) then -- when docked but not visible
      reaper.Main_OnCommand(50124, 0) -- Media explorer: Show/hide media explorer 
    end
    reaper.JS_Window_SetFocus(search)
  end
  
  -- Change keyword
  reaper.JS_Window_SetTitle( search, str )
end

UpdateMediaExplorerSearch( "héhé" )
X-Raym is offline   Reply With Quote
Old 08-13-2019, 01:31 PM   #666
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Could you try to convert the string using the utf8-functions Lua provides?
__________________
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-13-2019, 02:21 PM   #667
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,902
Default

@mespotine

I tried some utf-8 libraries without sucess but I dont see any native lua functions to try...


You can test my code if you want to test, it is ready to use :P


I see the utf8 function but it is limited. I tried utf8.char(233) and it appears as "é" in the field. Weird.

Last edited by X-Raym; 08-13-2019 at 02:27 PM.
X-Raym is offline   Reply With Quote
Old 08-13-2019, 02:53 PM   #668
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Hmm...usually a sign, that the conversion to utf isn't done completely. Happens to me from time to time with gfx.getchar.
__________________
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-14-2019, 07:05 PM   #669
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Thanks for pointing this out. I will shortly upload a new version with better UTF-8 / Unicode support.
juliansader is offline   Reply With Quote
Old 08-15-2019, 12:56 PM   #670
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Julian: You Rock!
__________________
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-26-2019, 12:17 PM   #671
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

I really like the idea of frameless windows, I'm just having difficulty using the function. I essentially just copied the portion of script you provided in post#663:

Code:
reaper.JS_Window_Create("not visible", "myClass", 20, 100, 500, 500, "POPUP")
Would you possibly mind providing a little documentation on its usage?
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 08-28-2019, 03:16 PM   #672
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

I can't think of much to write about the function: it simply creates a new window, and you can then use the GDI or Composite/LICE functions to draw inside the window (similar to how you would use native gfx functions to draw inside a window created by gfx.init), and WindowMessage, VKeys or Mouse functions to get user interactions. Is there anything specific you would like to know more about?

Does the code example in #663 work for you? (Do the red boxes bounce across the window?)
juliansader is offline   Reply With Quote
Old 08-28-2019, 10:28 PM   #673
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by juliansader View Post
I can't think of much to write about the function: it simply creates a new window, and you can then use the GDI or Composite/LICE functions to draw inside the window (similar to how you would use native gfx functions to draw inside a window created by gfx.init), and WindowMessage, VKeys or Mouse functions to get user interactions. Is there anything specific you would like to know more about?

Does the code example in #663 work for you? (Do the red boxes bounce across the window?)

Do you have a version of the script in text format so that I don't have to manually write that code? I'd be glad to give it a try.

The reason I was asking for documentation is I'm having difficulty figuring out how to employ the frameless window portion of the function...
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 08-29-2019, 02:39 PM   #674
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Code:
mode = "GDI" -- or "LICE"

popup  = reaper.JS_Window_Create("not visible", "myClass", 20, 100, 500, 500, "POPUP")
framed = reaper.JS_Window_Create("framed",      "myClass", 540, 100, 500, 500)
reaper.JS_Window_SetOpacity(popup, "ALPHA", 0.3)
reaper.JS_Window_SetOpacity(framed, "ALPHA", 0.3)

if mode == "GDI" then
    green = reaper.JS_GDI_CreateFillBrush(0x00FF00)
    red   = reaper.JS_GDI_CreateFillBrush(0xFF0000)
    font  = reaper.JS_GDI_CreateFont(15, 1000, 0, false, false, false, "Arial")
else
    bm = reaper.JS_LICE_CreateBitmap(true, 500, 500)
    reaper.JS_Composite(popup,  0, 0, 500, 500, bm, 0, 0, 500, 500)
    reaper.JS_Composite(framed, 0, 0, 500, 500, bm, 0, 0, 500, 500)
end

x = 0
direction = "RIGHT"

function loop()
    if reaper.ValidatePtr(popup, "HWND") and reaper.ValidatePtr(framed, "HWND") then
        if x >= 450 then direction = "LEFT" 
        elseif x <= 0 then direction = "RIGHT"
        end
        if direction == "RIGHT" then x = x + 10 else x = x - 10 end
        if mode == "GDI" then
            popupDC = reaper.JS_GDI_GetWindowDC(popup) -- DCs should not last langer than one defer cycle, and should be released as soon as possible
            reaper.JS_GDI_SelectObject(popupDC, green)
            reaper.JS_GDI_FillRect(popupDC, 0, 0, 500, 500)
            reaper.JS_GDI_SelectObject(popupDC, red)
            reaper.JS_GDI_FillRect(popupDC, x, 100, x+50, 150)
            reaper.JS_GDI_ReleaseDC(popup, popupDC)
            framedDC = reaper.JS_GDI_GetWindowDC(framed)
            reaper.JS_GDI_SelectObject(framedDC, green)
            reaper.JS_GDI_FillRect(framedDC, 0, 0, 500, 500)
            reaper.JS_GDI_SelectObject(framedDC, red)
            reaper.JS_GDI_FillRect(framedDC, x, 100, x+50, 150)
            reaper.JS_GDI_ReleaseDC(framed, framedDC)
        else
            reaper.JS_LICE_Clear(bm, 0xFF00FF00)
            reaper.JS_LICE_FillRect(bm, x, 50, 50, 50, 0xFFFF0000, 1, "COPY")
        end
        reaper.JS_Window_InvalidateRect(popup,  0, 0, 500, 500, true)
        reaper.JS_Window_InvalidateRect(framed, 0, 0, 500, 500, true)
        reaper.defer(loop)
    end
end

reaper.atexit(function() 
                  reaper.JS_Window_Destroy(popup) 
                  reaper.JS_Window_Destroy(framed) 
                  if mode == "GDI" then 
                      reaper.JS_GDI_DeleteObject(green) 
                      reaper.JS_GDI_DeleteObject(red) 
                      reaper.JS_GDI_DeleteObject(font)
                  else 
		      reaper.JS_LICE_DestroyBitmap(bm) 
                  end 
              end)

reaper.defer(loop) -- Must use deferred cycles, instead of for/while-loops, since on Linux and macOS, window graphics is only updated *between* defer cycles.
Oh, two other things that I should mention:
* On macOS and Linux, window graphics are only updated *between* REAPER's defer cycles, so you can't use for/while loops to animate graphics.
* The function doesn't seem to create proper frames on Windows 7 when using a Classic or Basic theme. I'm not sure why, yet.

What difficulties are you encountering with the frameless windows?
juliansader is offline   Reply With Quote
Old 08-30-2019, 06:55 AM   #675
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by juliansader View Post
Oh, two other things that I should mention:
* On macOS and Linux, window graphics are only updated *between* REAPER's defer cycles, so you can't use for/while loops to animate graphics.
* The function doesn't seem to create proper frames on Windows 7 when using a Classic or Basic theme. I'm not sure why, yet.

What difficulties are you encountering with the frameless windows?
Works great, thanks!

I suppose I didn't really understand how to use your create window function in a proper context. With the code you've provided me though, I'm sure I'll be able to piece together a more solid knowledge-base.

Thanks again!
__________________

Support my feature request!
Dafarkias is offline   Reply With Quote
Old 08-30-2019, 10:05 AM   #676
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,921
Default

Thanks for example!

When moving cursor over framed window borders the cursor image isn't resetting as expected after moving over left/right sides,..


Win10 x64, REAPER 5.983+dev0829a, JS 0.99
Edgemeal is offline   Reply With Quote
Old 09-01-2019, 10:38 AM   #677
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,820
Default

excuse me guys! is there any way to remove this from a window GUI?


Last edited by deeb; 09-01-2019 at 10:45 AM.
deeb is offline   Reply With Quote
Old 09-02-2019, 01:15 AM   #678
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

I'm not too proud to beg for scraps...

Would it be too much to ask for a code snippet displaying the operational use of the following functions?

reaper.JS_LICE_CreateFont()/reaper.JS_GDI_CreateFont()
reaper.JS_LICE_SetFontColor()/reaper.JS_GDI_SetTextBkColor()
reaper.JS_LICE_DrawText()/reaper.JS_GDI_DrawText()

Better yet, maybe I stop beating around the metaphorical bush and come right out with my intentions:

I'm trying to convert a scripted project timer window into a borderless window.

__________________

Support my feature request!

Last edited by Dafarkias; 09-02-2019 at 01:21 AM.
Dafarkias is offline   Reply With Quote
Old 09-02-2019, 03:58 AM   #679
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

Quote:
Originally Posted by Dafarkias View Post
Would it be too much to ask for a code snippet displaying the operational use of the following functions?
From my own scripts, check out js_MIDI Inspector:


The early versions of the script use GDI (you can download any outdated version via ReaPack), while the newer versions use LICE.
juliansader is offline   Reply With Quote
Old 09-02-2019, 01:23 PM   #680
Dafarkias
Human being with feelings
 
Dafarkias's Avatar
 
Join Date: Feb 2019
Location: Southern Vermont
Posts: 864
Default

Quote:
Originally Posted by juliansader View Post
From my own scripts, check out js_MIDI Inspector
As always, thank you!
__________________

Support my feature request!
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 05:46 PM.


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