is it possible to have dynamic menu items in a script? - Script Writing - CHDK Forum supplierdeeply

is it possible to have dynamic menu items in a script?

  • 8 Replies
  • 1240 Views
*

Offline Mlapse

  • ***
  • 239
  • A480 A490 S95 M10
is it possible to have dynamic menu items in a script?
« on: 09 / October / 2019, 13:41:40 »
Advertisements
the title says it all.
example:
I have 2 similar value sets, like: 0,5 0.6 0.8 1 1.3 1.6 2
if i choose 1 as first value, the second value choice should only have to contain numbers up until 1.

so after choosing a value in the first set i would like to limit the choices of the second set accordingly.

how would i go about creating a dynamic menu entry? like FI is used in the enhanced photo operations part of the menu?


« Last Edit: 09 / October / 2019, 14:20:28 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 12539
Re: is it possible to have dynamic menu items in a script?
« Reply #1 on: 09 / October / 2019, 21:11:21 »
so after choosing a value in the first set i would like to limit the choices of the second set accordingly.
Unfortunately, this is not possible. Each menu item defined in the script header is standalone, independent of the others.

I've wanted things like this too, but at the same time, I'd be reluctant to add to much complexity to the menu system.
Quote
how would i go about creating a dynamic menu entry? like FI is used in the enhanced photo operations part of the menu?
Hack https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk/core/gui_script.c I guess

Alternatively, you could implement the options interactively in the script, using the console or drawings and keyboard input.
Don't forget what the H stands for.

*

Offline Mlapse

  • ***
  • 239
  • A480 A490 S95 M10
Re: is it possible to have dynamic menu items in a script?
« Reply #2 on: 10 / October / 2019, 02:22:50 »

Unfortunately, this is not possible. Each menu item defined in the script header is standalone, independent of the others.

I've wanted things like this too, but at the same time, I'd be reluctant to add to much complexity to the menu system.

Was afraid the answer would be something like this.
And yes, i'm reluctant too to add more because i want to keep the script as lightweight as possible and user friendly settings are often just the opposite...as pointed out with your posted link to hack
« Last Edit: 10 / October / 2019, 02:39:44 by Mlapse »
frustration is a key ingredient in progress

*

Offline Caefix

  • ***
  • 189
  • Sorry, busy deleting test shots...
Re: is it possible to have dynamic menu items in a script?
« Reply #3 on: 09 / December / 2019, 12:27:04 »
Probably deplaced again, but I found some lines to do:

"@range VAR MIN MAX  [ :xmas step]"

Edit: Btw. the order has to be @param @default @range to get the limits checked.
Code: [Select]
@param    q Modus nofu
 @default q 2
 @range   q 1 98 16
@param    Q Modus nOfu
 @range   Q 1 98 16
 @default Q 2
« Last Edit: 12 / December / 2019, 13:14:45 by Caefix »
All lifetime is a loan from eternity.


*

Offline Caefix

  • ***
  • 189
  • Sorry, busy deleting test shots...
Re: is it possible to have dynamic menu items in a script?
« Reply #4 on: 23 / December / 2019, 14:26:59 »
 :o  :blink: Found out, that my few byte more gui_menu.zip features only work with auto-start, (SD card locked)
That´s probably common default, but a bit disturbing, nevertheless....
All lifetime is a loan from eternity.

*

Offline Mlapse

  • ***
  • 239
  • A480 A490 S95 M10
Re: is it possible to have dynamic menu items in a script?
« Reply #5 on: 18 / January / 2020, 10:34:51 »
thanks for the suggestion caefix, it took me some time to get it in action for my purpose. but the fact that it only works with the card lock method makes it not what i am looking for.
frustration is a key ingredient in progress

*

Offline philmoz

  • *****
  • 3155
    • Photos
Re: is it possible to have dynamic menu items in a script?
« Reply #6 on: 18 / January / 2020, 16:42:33 »
Probably deplaced again, but I found some lines to do:

"@range VAR MIN MAX  [ :xmas step]"

Edit: Btw. the order has to be @param @default @range to get the limits checked.
Code: [Select]
@param    q Modus nofu
 @default q 2
 @range   q 1 98 16
@param    Q Modus nOfu
 @range   Q 1 98 16
 @default Q 2


If you want to suggest code change for consideration into the code CHDK, I suggest:
- learn to use SVN and how to create patch files- provide some explanation on why the change would be useful, or some use-cases on where the change would help
- format your code changes so they are readable and conform to the standards used by the rest of the code
- add meaningful comments to the code, not just your name and the date
- don't include multiple changes in a patch with no additional explanation (this one includes some other uBasic related change for handling an @@ token in the script)


Phil.


CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)

*

Offline philmoz

  • *****
  • 3155
    • Photos
Re: is it possible to have dynamic menu items in a script?
« Reply #7 on: 18 / January / 2020, 16:47:14 »
:o :blink: Found out, that my few byte more gui_menu.zip features only work with auto-start, (SD card locked)
That´s probably common default, but a bit disturbing, nevertheless....


That's most likely user error on your part.


Booting with the firmware update method is done via the PS.FI2 file.
This is not built by default because the required fi2.inc file is not stored in SVN (it contains Canon encryption keys).


Phil.

CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)


*

Offline Mlapse

  • ***
  • 239
  • A480 A490 S95 M10
Re: is it possible to have dynamic menu items in a script?
« Reply #8 on: 19 / January / 2020, 02:56:30 »
Quote
If you want to suggest code change for consideration into the code CHDK

That was not my intent, because the only reason I want to change the menu to an interactive one is to make it easyer to understand for users.
Since I am no longer just that it has no real purpose for me.
I did add 2 lines of code in my script to support my S110 AFL setting. But because that is not easy to script with keypresses and still needs it's own call in a script I decided it had no added value if put into CHDK.
For now I've shelved the idea of a dynamic menu. maybe I'll dive into it again at the moment I am no longer a novice in lua.
thanks for the thoughts though, my understanding of CHDK has grown.
frustration is a key ingredient in progress

 

Related Topics