Single id for several objects

Discuss GUI programming with the MUI Royale plugin here
Post Reply
User avatar
r-tea
Posts: 133
Joined: Tue Feb 16, 2016 11:48 pm
Location: Zdzieszowice, Poland
Contact:

Single id for several objects

Post 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?
User avatar
airsoftsoftwair
Posts: 5626
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Single id for several objects

Post 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...
User avatar
r-tea
Posts: 133
Joined: Tue Feb 16, 2016 11:48 pm
Location: Zdzieszowice, Poland
Contact:

Re: Single id for several objects

Post 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.
User avatar
airsoftsoftwair
Posts: 5626
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Single id for several objects

Post 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"...
User avatar
r-tea
Posts: 133
Joined: Tue Feb 16, 2016 11:48 pm
Location: Zdzieszowice, Poland
Contact:

Re: Single id for several objects

Post by r-tea »

Sorry. The order is wrong. First, copy the object's addresse, then set the notification. It really works.
User avatar
airsoftsoftwair
Posts: 5626
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Single id for several objects

Post 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.
Post Reply