Page 1 of 1
Single id for several objects
Posted: Mon Mar 11, 2019 7:51 pm
by r-tea
I'm on my way to convert my MUI program made with E to Hollywood + MUI Royale.
Its GUI is configurable via icon tooltypes. For example, one can hide a slider and show it up in anoyher part of the window.
In E I do it this way (extremely simplified):
sl1:=SliderObject
sl2=SliderObject (hidden by default)
Only single slider can be shown at time in window.
Notification allways is set to sl1.
When user switches to the second slider I copy the address of sl1:
sl2 := sl1
then hide the group of sl1 and show up the group of sl2.
MUIRoyale uses ID's then I'm confused. Am I forced to use separate ID's for particular sliders or is there a way to avoid it?
Re: Single id for several objects
Posted: Tue Mar 12, 2019 10:32 pm
by airsoftsoftwair
Hmm, I don't really understand what's going on in your program but no, you can't use the same id for multiple objects. However, you can always free an object using
mui.FreeObject() and then the id will be available again...
Re: Single id for several objects
Posted: Wed Mar 13, 2019 9:16 pm
by r-tea
My explanations are actually a little wired.
To be exact, the trick is that in E I am able to handle several objects via single notification. Of course, not all of them at the same time. I need to switch between them bu copying their adresses. For example, I have five sliders: sl1, sl2, sl3, sl4, sl5. Then I set a notification like this:
Code: Select all
domethod(sl,[MUIM_Notify, MUIA_Slider_Level, MUIV_EveryTime, MUIV_Notify_Self, 2, MUIM_CallHook, get_colHook])
According to settings read from tooltypes at program's startup, lets say that only one those five sliders is shown.
Then I can copy its address to sl:
sl := sl4
And it's no need to set several notifications.
In Hollywood there is Switch - Case block with XML's IDs.
Re: Single id for several objects
Posted: Thu Mar 14, 2019 9:56 pm
by airsoftsoftwair
r-tea wrote: ↑Wed Mar 13, 2019 9:16 pm
To be exact, the trick is that in E I am able to handle several objects via single notification.
I don't understand how this should work in E. If you have five different sliders, you need to install notifications on all of them. I don't see how just copying pointer addresses should do that job, i.e. if you do
Code: Select all
domethod(sl,[MUIM_Notify, MUIA_Slider_Level, MUIV_EveryTime, MUIV_Notify_Self, 2, MUIM_CallHook, get_colHook])
sl:=sl4
then there won't be any listener on "sl4" just because you copy the "sl4" object's address to "sl"...
Re: Single id for several objects
Posted: Thu Mar 14, 2019 10:18 pm
by r-tea
Sorry. The order is wrong. First, copy the object's addresse, then set the notification. It really works.
Re: Single id for several objects
Posted: Fri Mar 15, 2019 7:45 pm
by airsoftsoftwair
Ok, then you should be easily able to imitate this behaviour using MUI Royale's
mui.Notify() function. This allows you to manually add or remove notifications to a MUI object.