Please re-activate set_console_autoredraw()!!!! - Script Writing - CHDK Forum

Please re-activate set_console_autoredraw()!!!!

  • 6 Replies
  • 4059 Views
Please re-activate set_console_autoredraw()!!!!
« on: 27 / November / 2010, 02:18:28 »
Advertisements
Hey,

CHDK is wonderful, thanks everybody for your great work!

I am into CHDK scripting and found the other day that set_console_autoredraw() is disabled.

Some scripts heavily depend on more sophisticated console writing (e.g. for displaying menus, file content etc.), where set_console_autoredraw() is essential.

Could you please re-activate it?

Another option would be to have the public functions of gui_draw.c available in scripting, this would be very nice. I would do it, if i could, but i can't :-(

Thanks in advance

heinzM
« Last Edit: 27 / November / 2010, 02:20:05 by heinzM »

*

Offline reyalp

  • ******
  • 14110
Re: Please re-activate set_console_autoredraw()!!!!
« Reply #1 on: 27 / November / 2010, 02:29:50 »
Can you give an example (preferably simple) of where set_console_autoredraw is needed, and how the current code behaves incorrectly ?

I'm not disputing that there's a problem, as I said in this thread: http://chdk.setepontos.com/index.php?topic=5793.msg57206#msg57206 I'm not really clear on what the previous behavior was and how it differs from what is in ultimAs contribution.

Calling the gui functions directly from script wouldn't work terribly well, because the script code runs in kbd task, not the spytask which normally handles the gui stuff. Having gui drawing capability from script would be nice, but it needs a bit more work than just making the existing functions available.
Don't forget what the H stands for.

Re: Please re-activate set_console_autoredraw()!!!!
« Reply #2 on: 27 / November / 2010, 02:48:04 »
Hi,

now this is what i call a quick response ;-)

Essentially, the print()-statement does not print anything, if set_console_autoredraw(0) is set, it just writes the string in the console buffer.

I have the follwing code, displaying a user menu on the console:
Code: (lua) [Select]
set_console_autoredraw(0)
cls()
for i=1,menuHeight do
if (i <= #menu) then
print(menu[i])
else
print()
end
end
console_redraw()
set_console_autoredraw(1)
the console covers the whole camera display. Drawing without set_console_autoredraw() is slow and fills the screen line-by-line. Drawing with set_console_autoredraw() is fast and the content of the console is displayed instantly.

Please drop me a line, if this explanation was not sufficient.

Best regards,

heinzM
« Last Edit: 27 / November / 2010, 03:02:37 by heinzM »

*

Offline reyalp

  • ******
  • 14110
Re: Please re-activate set_console_autoredraw()!!!!
« Reply #3 on: 27 / November / 2010, 03:01:07 »
ok, I think that makes sense.

The main thing you want to do is to be able to do is update the full console buffer without drawing anything, and then display it ?
Don't forget what the H stands for.


Re: Please re-activate set_console_autoredraw()!!!!
« Reply #4 on: 27 / November / 2010, 03:07:21 »
Hi,

thats right. I am "misusing" the console (meaning just appending lines) for use as a menu display, meaning updating just parts of the display, e.g. selection marks / highlighting.

An alternative would be a print(x,y,string) function with x,y-Parameters for the starting position on the screen (curses, sort of ;-)

heinzM

*

Offline reyalp

  • ******
  • 14110
Re: Please re-activate set_console_autoredraw()!!!!
« Reply #5 on: 28 / November / 2010, 01:59:10 »
I've re-added this in changeset 991 behavior may not be exactly the same, but I think should be reasonably close.

To test, I used the modified version of setmode.lua attached below. disp toggles auto-redraw or normal.

Quote
An alternative would be a print(x,y,string) function with x,y-Parameters for the starting position on the screen (curses, sort of ;-)
I have some ideas for this.
Don't forget what the H stands for.

Re: Please re-activate set_console_autoredraw()!!!!
« Reply #6 on: 28 / November / 2010, 05:37:20 »
works great, just like before!

Thanks very much!

heinzM

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal