Old 11-15-2018, 12:49 PM   #361
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 70
Default

Quote:
Originally Posted by Lokasenna View Post
Did you remember to include a call to the original methods inside both of yours? If you forget that, then the element literally doesn't know anymore what it's supposed to be doing.
I'm not sure, are these right? I just copy from where I declared them the first time. And "onmousedown" still worked but "ondrag" didn't

PS:I said the ondrag thing did not work, it meaned the slider was not only failed to run functionB, but also failed to drag the slider’s handle

Code:
function functionB()

 some codes

end

function functionA()

  some codes

    GUI.New("mylider", "Slider", {     --recreate the slider
        z = 11,
        x = 1096.0,
        y = 5.0,
        w = 106,
        min=0,
        max=newvalue,                  -- new value of max
        defaults=0,    
        caption = "myslider",
        font = 3,
        col_txt = "txt",
        --col_fill = "elm_frame",
        show_values=false
       
    })    

    function GUI.elms.myslider:onmousedown()      --have to declare it again

     GUI.Slider.onmousedown(self)
   
      funntionB()
      
    end
    
    function GUI.elms.myslider:ondrag()           --have to declare it again

      GUI.Slider.ondrag(self)

      functionB()

    end

  reaper.defer(functionA)

end

Last edited by dsyrock; 11-15-2018 at 06:19 PM.
dsyrock is offline   Reply With Quote
Old 11-17-2018, 10:08 PM   #362
MusoBob
Human being with feelings
 
Join Date: Sep 2014
Posts: 415
Default

How do I , oh how do I... not the song, but how do I call a function once the text is entered in the "Textbox" ?
MusoBob is offline   Reply With Quote
Old 11-17-2018, 11:46 PM   #363
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 1,940
Default

Maybe Check the events in textbox class? onSomething. I am not on computer so can't help.
deeb is offline   Reply With Quote
Old 11-18-2018, 05:07 AM   #364
MusoBob
Human being with feelings
 
Join Date: Sep 2014
Posts: 415
Default

Thanks, I could see onmousedown() ondoubleclick() onupdate() ontype() onwheel() ondrag()

Code:
function GUI.elms.bar1_1:onmousedown()
         reaper.SetEditCurPos(0.0, 0, 0)   
         reaper.Main_OnCommand(40616,0) --Markers: Edit region near cursor
end
to bring up Edit region near cursor.

I can't see how to get
red, green, blue = reaper.ColorFromNative(region_color)
in a frame background color
bg = ????,


..
MusoBob is offline   Reply With Quote
Old 11-18-2018, 09:35 AM   #365
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 1,940
Default

Quote:
Originally Posted by MusoBob View Post

to bring up Edit region near cursor.

I can't see how to get
red, green, blue = reaper.ColorFromNative(region_color)
in a frame background color
bg = ????,


..
maybe better to ask in another thread, as more people will be able to reply : )
deeb is offline   Reply With Quote
Old 11-18-2018, 12:22 PM   #366
MusoBob
Human being with feelings
 
Join Date: Sep 2014
Posts: 415
Default

red, green, blue = reaper.ColorFromNative(region_color)
GUI.colors["region"] = {red, green, blue, 255}


GUI.New("frame_1", "Frame", {
z = 11,
x = x1+0.0,
y = y1+192.0,
w = 255,
h = 40,
shadow = false,
fill = false,
color = "elm_frame",
bg = "region",
round = 0,
text = "17",
txt_indent = 0,
txt_pad = 0,
pad = 1,
font = 4,
col_txt = "txt"
})

Last edited by MusoBob; 11-18-2018 at 03:30 PM.
MusoBob is offline   Reply With Quote
Old 11-18-2018, 04:35 PM   #367
MusoBob
Human being with feelings
 
Join Date: Sep 2014
Posts: 415
Default

I can update the textbox value
GUI.Val("bar1_1", chord_name)
I need to also to update the Frame bg color in the above post.
MusoBob is offline   Reply With Quote
Old 11-21-2018, 10:08 AM   #368
xpander
Human being with feelings
 
xpander's Avatar
 
Join Date: Jun 2007
Location: Terra incognita
Posts: 4,373
Default

Thank you Lokasenna for this GUI library and tools!

I thought of trying to copy a specific keyswitch panel idea and with the help of the GUI Builder, the first step was really easy. But now that I have buttons in four columns like I want them, how could I go about changing the visibility of those columns depending on what buttons are pressed?

The idea is following: left column stays always visible/active, so it's on top of the hierarchy. The visibility/availability of any other columns to the right would then depend on what button was pressed on the previous column. In this example picture, there could be e.g. a column 5, but because of the choices made on previous columns, it's not available.



Another related question; how to highlight or frame the last pressed button on every column like in the mock-up above?

Any ideas appreciated, thanks.

---
edit: testing layer visibility management next...

Last edited by xpander; 11-22-2018 at 05:37 PM.
xpander is online now   Reply With Quote
Old 11-21-2018, 12:48 PM   #369
MusoBob
Human being with feelings
 
Join Date: Sep 2014
Posts: 415
Default

That's what I'm trying to do in the previous post, to update the frame.
You could have a frame behind the button that changes color.
This could also change with the on/off state if it's a Reaper toggle action

You can also use images and change them.
I think to update my buttons I had to add a ondelete so to delete the old button first.


This is show cue markers toggle:
Code:
function update_show_chords_in_items() 
      
--Delete old buttons before updating  

   if reaper.GetToggleCommandState(40691) == 1 then onstate = "black" textstate = "red"
   else
     onstate = "gray" textstate = "yellow"
   end
GUI.elms.show_chords_in_items_btn:ondelete()
 
GUI.New("show_chords_in_items_btn",      "Button",           3, 275+x1, 180+y1, 135, 20, "Show Chords in Items", btn_click_show_chords_in_items)
GUI.elms.show_chords_in_items_btn.col_txt = textstate
GUI.elms.show_chords_in_items_btn.col_fill = onstate    

GUI.elms.show_chords_in_items_btn:init()    

end



   if reaper.GetToggleCommandState(40691) == 1 then onstate = "black" textstate = "red"
   else
     onstate = "gray" textstate = "yellow"
   end
Code:
function update_chord_buttons() 
      
--Delete old buttons before updating  

    GUI.elms.lb_chords_on:ondelete() 
    GUI.elms.lb_key_chord:ondelete()
MusoBob is offline   Reply With Quote
Old 11-24-2018, 06:51 AM   #370
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 1,940
Default

I am away from PC. If nothing mentioning in frame class about border color, maybe you can layer a second layer of frame behind the other, with some more pixels on height and width, so that fill color can work as a border. Not sure, just a thought.
deeb is offline   Reply With Quote
Old 12-02-2018, 02:43 PM   #371
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 221
Default When docked, and trying to resize the width, it crashes.

What can I do to prevent the script from crashing when resizing the width of the GUI (I've got mine in the Docker when this happens)?

Code:
Error: Reaper DAW Interface GUI.lua:1852: attempt to index a nil value (global 'gui')

Stack traceback:
	Core.lua:70: in metamethod '__index'
	Reaper DAW Interface GUI.lua:1852: in field 'func'
	Core.lua:292: in function <C:\OneDriveTemp\OneDrive\Lokasenna_GUI v2\Library\Core.lua:280>
		[C]: in function 'xpcall'
	Core.lua:280: in function <C:\OneDriveTemp\OneDrive\Lokasenna_GUI v2\Library\Core.lua:279>

Lokasenna_GUI:	(the file is not owned by any package entry)
Reaper:       	5.962/x64
Platform:     	Win64
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 12-03-2018, 09:02 AM   #372
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 302
Default Docking Lokasenna GUI?

Is it possible to dock a script made with Lokasenna GUI?

Cant do it on linux.....

Regards
TompaD
__________________
ToDoList Donate Mark4Celest: Frid (i ditt hjärta) Eve & the Fisherman on Spotify
tompad is offline   Reply With Quote
Old 12-03-2018, 03:35 PM   #373
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 221
Default

Quote:
Originally Posted by tompad View Post
Is it possible to dock a script made with Lokasenna GUI?

Cant do it on linux.....

Regards
TompaD
I'm not sure if this is the 'right' way to do it, but here's how I am docking it on start up for Windows 10 / 7:

Code:
local function Init()
	reaper.Main_OnCommand(41172) -- Dock/undock currently focused window
end
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."

Last edited by tXShooter; 12-03-2018 at 03:36 PM. Reason: Typo
tXShooter 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 04:28 PM.


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