Edit Box and Registry Variable


Recommended Posts

I'm very new, but I've read a lot and I'm still stumped on this.

I want to have an edit box where a user can type in a one decimal place value between 0 and 14. For example, 7.2.

Then, I want to set a Registry variable so that the value persists if you turn the computer on and off.

I know that Registry variables must be integers, so I figure I need to do something like:

Registry.MyValue = value * 10

and then everywhere I use it I'll do something like:

NewValue = Registry.MyValue / 10

But, where/how do I set that Registry variable in the edit box preferences? Is there a better way?

Link to comment
Share on other sites

As I say often (and in the blog), you really should avoid using edit boxes on primary pages. This is yet another reason: there is no event to tell you when the value changes. You are much better popping up a window requesting the value. Then you can do range checking and update the registry. To do this, create a button with a Quick Sequence action. Then in the script for the action put something like:

private datain = system.EntryDialog("Enter a value between 0 and 14", 14, 0, registry.myvalue/10)
if (!isempty(datain))
   registry.myvalue = datain * 10
endif

I personally would actually use a global variable that holds the real value, load it from the registry in an Auto-Start sequence, then update both it and the registry from the above script.

Link to comment
Share on other sites

That worked except for two problems. The way you had it, it would only let me enter values greater than 14. So, I swapped the 0 and the 14 and that worked:

private datain = system.EntryDialog("Enter a one decimal place number for the pH Setpoint between 0 and 14", 0, 14, registry.myvalue/10)

Is the documentation wrong? Is it min then max?

Second, the prompt is long and it wrapped to the second line. But the input box didn't automatically adjust and it wrote on top of the second line. How do I fix that?

I'm using version 5.83 build 1632.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.