Repository navigation
Replies: 2 comments
|
You’re right that it goes through the form handle. The method you want is f:set_label(), not f:set(): f:set() changes a field’s value, while a label’s text is its caption. Put it in an on_change callback on the number field, and add an on_open so the label is right as soon as the form appears: local function updateMaxLabel(f) local v, button = opensak.form{ How it behaves: on_change fires immediately when the arrows are clicked. When a value is typed, it fires on Enter or when the field loses focus. The form stays open either way (exit_on_change would close it, so leave it false). Two small things I noticed while reading the script: Line 29 is missing a >: <titleOptimized PQ Date Ranges</title> should be <title>Optimized PQ Date Ranges</title>. The full list of form-handle methods (get, set, set_label, set_enabled, set_visible, set_options, …) is under Forms in the API reference (F1 in the macro editor). |
|
Thanks! That helped a ton. I just needed to see an example.
Additionally, I discovered that I had "remember" true for a couple of
fields but had failed to set it at the form level so I was scratching my
head on why it wasn't working.
Nice catch on the two other errors I had hiding in there. While I MIGHT
have eventually noticed the error in the html page title, chances are I
would never have noticed the empty db logic flaw at all.
|
Uh oh!
There was an error while loading. Please reload this page.
Am porting the GSAK PlacedPQ macro and am VERY close. Getting same end results in both OpenSAK and gsak. However, have one final thing to port that I can't quite figure out and hope someone can provide the answer.
When the form is displayed, the value of MaxCachesLabel (a label field of the form) is supposed to be dynamically calculated by the formula maxPQSize (a global val = 1000) MINUS bufferCombobox (a value that is set in the form). I assume this is going to (somehow) involve use of f:set to use the form handle to change the value whenever the value of bufferCombbox changes - but the way to code this escapes me.
Can someone clarify?
The in-progress code is attached if needed. Extension changes to txt since I can't attach .lua files.
OptimizePQs.txt
All reactions