Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 2847 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I want to create an image of the clock, with round dial, numbers as buttons (from 1 to 12, maybe even half an hour numbers). So here is the challenge (for me...):

1. Each button changes color on a corresponding slice of the clock, if you click once - white, click again - original color and so on back and forth between those two colors... Multiple colors would be nice too.

2. Using two buttons to select a chunk/slice of the dial, for example click on 12 and 4 will turn slice between 12 and 4 numbers into white color automatically without clicking on each number in between.

OK, changing colors - conditional formatting - easy. Using one script for doing it - script parameter - easy.

But then I can't get my mind around the rest of the puzzle. Here are my questions:

a. How to keep selected color (it changes if I click different number), without going into using complex calculations and multiple fields.

b. For my second problem (creating a slice) - I don't even know how to approach it...

c. Also simple question: what is better to use as buttons in this case - field, object, or smth else?

There must be a much more efficient and elegant way to do it. My guess is - variables, but I m getting lost with them.

Any help please...

 

 

Posted

Hi Monarch, would you explain the purpose of this?  Is it so a User can select a time which must be stored in the table?  Is it for the developer to provide the User with feedback of some sort?  Knowing what you wish to do with this information will help us determine what to provide.  :-)

Posted

I think you have more than one question here. Before getting into any one of them, I would ask how do you plan to handle AM vs. PM with only 12 buttons to select from.

Posted

Yeah... AM/PM  is also a question.

This is for a schedule program which I am trying to create. I like visual stuff, so I thought it would be nice to have a clock like that.

The idea is to select a "slice" of time and then transfer it to a table for each active row in the portal. I hope I explained it clear...

It sounded simple to me at first. But if it s getting too much - I might have to drop the whole idea :( and just stick with "boring" text and numbers.

And thank you guys for replies!

 

Posted
5 hours ago, Monarch said:

AM/PM  is also a question.

Well, I don't have an answer for that. I should also add that I don't recall seeing any application that uses slices of an analog clock face to select a time range* - and I always prefer to stick to established UI conventions. Perhaps you should consider a horizontal timeline with 24 (or less, if your scheduling is limited to certain hours of day only) segments, where you can select a range by clicking on the start and end segments.

In any case, selecting and conditional formatting are two quite separate issues. Selecting should result in values being entered into the StartTime and EndTime fields of the appropriate record. Conditional formatting needs to be based on these values - so it will continue working even when the values have been entered using an alternative method.

--
(*) Apple have an analog clock in System Preferences where you can select a time (not range) by dragging the minute hand. I suppose with a lot of work something like that could be implemented using SVG or HTML 5 in a web viewer.

Posted

Thank you Comment.

I guess I have to drop it.

I will play with it for an educational purpose a bit...

So here is a more specific question:

We have three objects - A, B, C.We have three buttons - 1, 2, 3. Press 1 once - we change A to "red", press 1 again will change A to "green" and so on... Can we do it using one script?

Assigning script parameter is one step, then I tried to set variables for each object. Changing each variable will effect conditional formatting of the object. That was my idea. But I don't know how to pick the right variable from the script...

Or do  I need to create three fields instead of objects? Or is there a totally different approach?

Thank you for your help.

 

 

Posted
4 hours ago, Monarch said:

Press 1 once - we change A to "red", press 1 again will change A to "green" and so on... Can we do it using one script?

Yes, we can, provided we have something - a field or a variable - that remembers the current state of "A". This is what I said earlier about separating between selecting and formatting: pressing the button needs to change the value of the field (or the variable); in turn, the color of the object is determined solely by the value of the field (or the variable), no matter how that value was established.

As for the script itself, you don't even need a parameter. Let's say there will be 4 states, designated as 0, 1, 2 and 3 and a field named Status to hold the current state.. Have the script set the Status field to:

Mod ( Status + 1 ; 4 )

and watch the field rotate among the values with each press of the button.

 

Now, if you want to reuse the same script for other button/field/object combinations, then pass the field name as the parameter, and have the script do:

Set Field By Name [ Get ( ScriptParameter ); Mod ( GetField ( Get ( ScriptParameter ) ) + 1 ; 4 ) ]

Alternatively, you could forgo the script and just make each button perform a single-action Set Field step.

 

The choice whether to use fields or variables depends on what's this really about: keep in mind that a variable is specific to the current user and expires at the end of the current session.

  • Like 1
Posted

Thanks again Comment.

The "Mod"  function is awesome! So simple and works great.

But I ve tried to do the script, like you said with "Set Field By Name" and it doesn't work for some reason... That step doesn't want to see "Get (ScriptParameter)" as the name of the field. I ve set field as text, even number, copy/paste name as parameter ( it gets in quotation automatically) but in the script it doesn't go back to that field with the same name...

Spent the whole day trying to figure it out.

Any thoughts?

But I have set, as you said again, directly "set field" without script - and it works like a charm!

 

 

 

 

Posted
20 hours ago, comment said:

See if this works for you:

 

 

FieldNameAsParameter.fp7

Thank you so much comment!!!

I saw my mistake right away - I didn't use GetFieldName in parameter...

Now everything is working and I can get on with my life!

Thanks again.

This topic is 2847 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.