View Single Post
Old 08-14-2017, 08:11 AM   #45
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,813
Default

hello lokasenna. I have updated and everything is smooth thank you!

I would like to know how you would deal if you had this situation:
Code:
GUI.MyMenubox = GUI.Menubox
GUI.MyMenubox.mouse_up= GUI.MyMenubox.onmouseup
function GUI.MyMenubox:onmouseup()	
    self:mouse_up

   -- update the visible elements
   
   
end



GUI.New("tabs", 	"Tabs", 		1, 0, 0, 64, 20, "Tab 1,Tab 2", 16)

optionValues={"A","B","C","D","E","F"} 
GUI.New("my_mnu", 	"MyMenubox", 		3, 1, 40, 64, 20, "Option:", table.concat(optionValues, ","))

for i, v in ipairs(optionValues) do
      GUI.New("my_lbl"..i, 	"Label", 		3, 1,50+ 30*i, "Label on Tab1 visible if option "..v.." selected!", true, 1)
end

I would like in this example the labels to be shown if the corresponding option is selected. I don't know if i should make a new z layer, or whatever. That is why i am asking your opinion.

1) The direct way should be on mouse_up :
Code:
foreach label 
   -> change to z to 0  if supposed to be unvisible
   ->change to z to 3 if supposed visible
end
2) a more interesting way would be to override:

Code:
GUI.New = function (name, elm, ...)
with:
Code:
GUI.New = function (zz ,name, elm, ...)
or

Code:
GUI.New = function (optionOwner ,name, elm, ...)
and then on mouse_up update GUI elements.

3) so i would like to know your thought. What would be you're way of doing this? 1, 2 or which way?

4) Also: is there a way to call the new element instead of a string to be an array?
like this:
Code:
GUI.New("slidername[0]", "MySlider", 1, 1, 1 , 150, "", 0, 100, 100, 50, "h")
or it doesnt make sense at all?

5) Also : ) is there a way to know is there is any modifier key pressed inside a function like this:

Code:
GUI.MyChecklist = GUI.Checklist
GUI.MyChecklist.mouse_up= GUI.MyChecklist.onmouseup
function GUI.MyChecklist:onmouseup()
  - Here i want to know if ctrl key is being pressed
end
edited: we can use: gfx.mouse_cap as i was told by Xenakios once

Thank you


Edit: Don't spend much time on this: for now they are just theorically question and interesting for future, but i am not even sure if i need this (1,2,3,4), but i am curious anyway and i guess good info for someone who uses this Lib.

Last edited by deeb; 08-14-2017 at 11:25 AM.
deeb is online now   Reply With Quote