Home › Forums › General › Programming › The Old Popup Menu Issue
- This topic has 19 replies, 3 voices, and was last updated 5 years, 7 months ago by lfo2vco.
-
AuthorPosts
-
September 15, 2018 at 12:06 pm #85218
Hi Guys,
I’m trying to sort out my popup menus in an exported vst version of my panel, I have adopted the method Atom described in his post here:
So I have a method called ‘isReady’.
isReady = function() if panel:getBootstrapState() == false and panel:getProgramState() == false then return (true) else return (false) end end
Then my popup menu methods go like this.
kiwiMenu = function(mod, value) if isReady() then -- Main Menu kiwiMain = PopupMenu() -- Load Bank Menus loadBank = PopupMenu() -- Blah, blah, blah all the menu stuff which I‘ll leave out end end end
Now my problem is that this works fine in ctrlr standalone, but the menus fail to operate at all in the vst. Initially when my DAW launched they appeared randomly just after the DAW splash screen.
Any suggestions as to how I might improve this situation, as always will be very appreciated.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 18, 2018 at 1:23 am #85228Hi Guys,
So I have been trying stuff out unsuccessfully… however my popup menu methods now look like this.
kiwiMenu = function(mod, value) if isReady() == true then -- Main Menu kiwiMain = PopupMenu() -- Load Bank Menus loadBank = PopupMenu() -- Blah, blah, blah all the menu stuff which I‘ll leave out end elseif isReady() == false then return end end
I have also been trying to implement this:
PopupMenu:dismissAllActiveMenus()
Trouble is whatever I try I either end up with popups that fail to operate at all or they still launch during my DAW boot up and when dropped into the sequencer window!
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 18, 2018 at 7:00 am #85229I have struggled with this too. I think I solved it with the code below. So far so good anyway.
I initialise the variable allowPopUp=false in a function myInitialise() on startup In → “Called when the panel has finished loading“.Then when I call a function containing a pop-up I run a timer within that function to switch to allowPopUp=true.
Regards.
myInitialise = function(--[[ CtrlrInstance --]] type)
allowPopup = false
end --function
---------------------------------------------------------
function timerCallback(timerId)
-- Load program timer
if timerId == 1 then
--do something here
timer:stopTimer(timerId)-- Load panel timer
elseif timerId == 2 then
allowPopup = true
timer:stopTimer(timerId)
end
end --end function
---------------------------------------------------------myFunction = function()
-- Starting a timer to reset allowPopup to true to stop a popup when program first loads
timer:setCallback (2, timerCallback)
timer:startTimer(2, 200)
if allowPopup==true then
utils.infoWindow("Program information", "This is a pop-up message")
end
end --end function
---------------------------------------------------------
See: below for updateSeptember 18, 2018 at 12:21 pm #85230Thanks dnaldoog,
I’ll give that try and let you know how I get on.
lfo2vco
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 18, 2018 at 12:49 pm #85231IMHO there is no issue directly related to the popup menu. In some cases lua scripts are executed on startup – e.g. when you attach a script to the “on value change” of a button. Use “on mouse down” instead and it will work as expected.
September 19, 2018 at 4:37 am #85237The problem with the code I posted above is that you have to click the popup button twice, because after the timer has returned and registered the variable allowPopup = true, the if allowPopup == true condition isn’t fired. ( I thought it should )
timer:setCallback (2, timerCallback)
timer:startTimer(2, 200)
if allowPopup==true then
utils.infoWindow("Program information", "This is a pop-up message")
end
… so while it works, it’s not ideal and nothing else seemed to work, except this:
In the function that is called when the panel has loaded myInitialise() I add a timer instead of in the function containing the popup (so the timer is fired at startup):
myInitialise=function()
allowPopup=0
timer:setCallback (77, timerCallback)
timer:startTimer(77, 50)
end -- function
… in the timer function:
function timerCallback(timerId)
-- Load program timer
if timerId == 77 then
allowPopup=1
timer:stopTimer(timerId)
end --fi
end --end function
… finally in the function containing the popup:
myFunction=function()
if allowPopup == 1 then
utils.infoWindow("Program information", "This pop-up message should not popup on program load")
end --fi
end -- function
The popup should now be generated on a single click.Also with this version the allowPopup variable remains set at 1 during runtime and the timer is only ever called once.
In the first version the timer is called each time the function is called, which is maybe not necessary.See attached panel below, which doesn’t use
panel:getBootstrapState()
orpanel:getProgramState()
. They don’t work for this problem.
You should see two popups appear on load, but there is a third one, which should only trigger when the purple button is pressed on the panel.Attachments:
You must be logged in to view attached files.September 19, 2018 at 9:52 am #85239IMHO there is no issue directly related to the popup menu. In some cases lua scripts are executed on startup – e.g. when you attach a script to the “on value change” of a button. Use “on mouse down” instead and it will work as expected.
Hi Possemo,
The issue is all mine as I have been trying to work around this for a while : ~ )
So do I understand you correctly this can be done with a uiButton or do I need to use a static of some other component? I ask this as I have checked the ‘Trigger button on mouse down events’ check box under ‘Component Generic’ set the values for the On and Off states both to 0. However I am still getting the popups on load. My method is still attached via ‘Called when the modulator value changes’.
Hi dnaldoog,
Thanks for update, I am going to pursue Possemo’s comment first as it sound like it avoids workaround scripting… lets see how this goes. Nice demo panel by the way, very useful.Cheers for your replies.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 19, 2018 at 12:39 pm #85240I am using an uibutton in most cases but it works with static labels as well. Important thing is using “on mouse down” instead of “when value changes”.
September 19, 2018 at 12:43 pm #85241I am using an uibutton in most cases but it works with static labels as well. Important thing is using “on mouse down” instead of “when value changes”.
OK, where do I attach the method to the uiButton if I am not using ‘Called when the modulator value changes’?
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 19, 2018 at 10:40 pm #85243Thanks dnaldoog,
I had some spare time this evening so I tried out your solution on my panel. It works, thank you very much. The example panel was of great assistance.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 20, 2018 at 12:43 am #85244you attach it here (see screenshot). If the workaround from dnaldoog does work for you just go for it. I prefer the “simple and stupid” method but this is my personal preference.
Attachments:
You must be logged in to view attached files.September 20, 2018 at 12:50 am #85246Thanks lfo2vco – I am happy to hear that it helped you, but I discovered that Possemo is 100% correct!
I never realised that or even thought of that as a solution.
Here is version 02 ↓ of that panel with a uiButton using the Called when mouse is down on this component event.
Even though my solution works, it’s a workaround as Possemo states, so I’ll probably change my panels to use the mouse down event now.
You live and learn!
Attachments:
You must be logged in to view attached files.September 20, 2018 at 1:23 am #85249Hi Guys,
Well I thought I was going daft and missing something, however it would seem that it is my version of ctrlr that has something missing!
So for the moment I’ll have to go with dnaldoog’s method until I can sort out why these options are not available to me.
That said I am now looking for someone who can export restricted instances for PC / Windows.
Attachments:
You must be logged in to view attached files.Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 20, 2018 at 4:49 pm #85251There might be one good reason for using the workaround using a timer above. It seems that the component uiImageButton doesn’t trigger a function with a Mouse Down event.
There’s a post here about it by Goodweather. March 20, 2016
Difference for MouseDown behaviour between uiImageSlider and uiImageButton
The function is only triggered by a click on the label, not the image itself.
Of those four mouse events a function is only triggered by the mouse hover event. No ‘click event’ involved there of course.
I tested this on Ctrlr 5.3.201 & Ctrlr Version 5.5.2 (latest version at time of writing) Windows 10.September 22, 2018 at 12:03 am #85256I didn’t knew that uiImageButton ist broken – good to know, thanks for this information.
@lfo2vco: this is not normal behavior of Ctrlr for MacOs. On my virtual machine with newest MacOs it does work flawlwessly (see screenshot). Is it also broken when you create a new button?- This reply was modified 5 years, 7 months ago by Possemo.
Attachments:
You must be logged in to view attached files.September 22, 2018 at 12:30 am #85259Hey Possemo,
I think I know why I have this peculiarity in my panel. I created the panel in Ctrlr version 1590, when I started my update I thought it was a good idea to download the then latest version (not sure of number), however I had some problems. I was advised to backdate to Ctrlr version 1590, however as I had worked on the panel and saved it there seem to be some artefacts of the newer version that are not implementable.
So in answer to your question if I make a new panel and create a new uiButton it is entirely as it should be for Ctrlr version 1590.
As I am familiar with this version, old or not I am kind of sticking with it for the time being, especially as the update is pretty much done. However what Mac version are you using (virtually)?
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 22, 2018 at 4:43 pm #85265I am using the newest Mac version (the only one avaiable in the download-area) but I am using it only for testing purpose. I know that this version has some bugs – e.g. you cannot attach pictures to image-components.
If your buttons are broken due up- and downgrading you could try to delete them and create new ones.
September 22, 2018 at 7:32 pm #85266The button are OK and work within the constraints of Ctrlr version 1590, options from the newer version are listed but just not available. I can work with that.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystalSeptember 23, 2018 at 3:11 pm #85272I would consider to develop Ctrlr panels on Windows. IMO the recommended Windows build would be the best one for developement. There are powerful virtual machines on OsX to run Windows just like on a regular PC. Just for running panels and making instances the newest Ctrlr Mac build does work flawlessly. I see that installing a VM is quite some work and developement process of panels would be more complicated. it’s just a suggestion.
September 23, 2018 at 3:22 pm #85273Good point, I’ll check out the latest Mac download now my current project is done.
Macs have a utility called Bootcamp which lets you run Windows on the hardware bypassing the need for a VM running in the OS, which is a good option too (especially if you have a second machine to hand).
Thanks again Possemo.
Here is some noise I organised into an acceptable format:
https://soundcloud.com/lfo2vco/a-dark-crystal -
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.