06-07-2010 08:44 AM
Hi everyone,
I know that Arrays must be of the same type (U32, booleans, char...). But I'm wondering if arrays can be of identical elements but with different styles : Example :
Can these 2 elements be stored in the same array?
I'm asking the question in order to clean up my code with my movie player. Rather than having different events (play, pause, forward...), i'd like to store all the buttons in an array and just search for TRUE case in it :
Free customized buttons if someone answers !
PS: I thought to bundle all the movie elements in a cluster and register the "cluster value changed" event...
06-07-2010 08:49 AM
Hi!
I'd suggest to use a picture ring control instead of a boolean.
Each element of the array would be then of the same type (the picture ring) and can have a different value, i.e. a different picture.
Marco
06-07-2010 09:07 AM
I always forget that picture rings exist... But it looks like the problem won't be solved with them. You must use booleans to have 2 (4 or 6) different states associated with user events.
I have just tried to create an array of picture rings but it seems impossible to have different pict rings with different pictures inside the array. They are all the same...
06-07-2010 09:13 AM
I am not sure what you tried but the array of picture rings works fine for me. Create on ring with all the images you want. Then put that ring into an array. Each element of the array can be set to display a different image. Be sure to save as default.
Lynn
06-07-2010 09:32 AM
I didn't notice that each element of the array was displaying a different image... Thanks! But I am not sure it solves the problem. Because now, I lose all the advantages of a boolean type...
Consider that I have 4 buttons : play, stop, back and next (4 state buttons). That gives 16 images that I have now to display manually. The Search array function will only work for 4 of them : when a user clicks on a button, and will ignore the rest of the states. It will complicate the code given the fact that I must check mouse leave, etc...
06-07-2010 09:43 AM
Overlay the images with transparent booleans. Make the array of picture rings an indicator. When a boolean button is pressed, write the appropriate values to the array to produce the visual appearance you want the user to see.
Lynn
06-07-2010 09:43 AM - edited 06-07-2010 09:44 AM
Hi superfunk,
as you don't want to handle the "buttons" manually you should go the "cluster of different booleans" way...
When there are only booleans in the cluster you still can convert easily between cluster and array of booleans (but I wouldn't do this all the time...).
06-07-2010 09:43 AM
Provided I don't understand why you don't want to use 4 plain controls :),
with the picture array you can catch the button being pressed in a way similar to the following:
...and, if you want, you can change the picture from NotPressed status to a Pressed status (meaning you need a number of pictures twice the number of buttons...)
Marco
06-07-2010 09:53 AM
GerdW wrote:
Hi superfunk,
as you don't want to handle the "buttons" manually you should go the "cluster of different booleans" way...
This is what I'll do!
Thanks all for your suggestions. 4 plain controls could have been nice too... By the way, no one is aking after my wonderful little buttons ? I must think of uploading them to the GUI community...
06-07-2010 10:20 AM
Hi superfunk,
either post them to the GUI usergroups or to the example code pages... (I would prefer the UI interest group...)