Page 1 of 1

Editbox and other objects

Posted: Sun Aug 15, 2010 3:00 pm
by cocoking
How do I add a Close button in editbox and other similar objects?
Or, is it possible to add something like: On Escape, close object?

Also, how do I hide cursor in an editbox (created as readonly)?

Once again, thank you for the help.

Re: Editbox and other objects

Posted: Wed Aug 18, 2010 1:21 pm
by cocoking
The original post did not get a reply, so please allow me to re-phrase my question.

In a form, there is an editbox object. After reading, how do users close the editbox (since there is no Close button)? In the program, I cannot issue a Release statement because there is no trigger.

So, I tried this:

@ 10, 10 EDITBOX ebRein ;
PARENT MainForm ;
WIDTH 300 ;
HEIGHT 300 ;
VALUE "Reindexing files..." + CRLF ;
ON GOTFOCUS ReinQuit();
READONLY
...

function ReinQuit()
// quit editbox if escape is pressed by user

if lastkey() == K_ESC
MainForm.ebRein.Release
endif

return NIL


It did not work. What I was trying to do was:

if object has focus, check if last keypressed is ESC.
If yes, then close object.

Any idea how to do it?
All I want is allow the user to close the editbox.

Please help. TYVM.

Re: Editbox and other objects

Posted: Wed Aug 18, 2010 1:54 pm
by mol
LASTKEY does not work in GUI.
You can add:

Code: Select all

ON KEY ESCAPE OF MainForm ACTION ReinQuit()
or

Code: Select all

ON KEY ESCAPE OF MainForm ACTION MainForm.ebRein.Release

Re: Editbox and other objects

Posted: Thu Aug 19, 2010 3:33 am
by cocoking
It worked! Thank you very much, Marek.

Is this the only way to allow the user to close an object?
Is it not possible to add a Close button (X) at the top-right part?

This editbox is a progress window for indexing files. While indexing is going on, I pressed Esc. It did close the editbox window but the indexing process did not terminate prematurely (thankfully!).

Thanks again, Marek, you've been a very big help to me.

Re: Editbox and other objects

Posted: Thu Aug 19, 2010 5:32 am
by mol
You can use standalone button and set its action to release editbox.

I'm glad to help you!
Marek

Re: Editbox and other objects

Posted: Sun Aug 22, 2010 2:21 pm
by cocoking
Thanks, Marek, for the suggestion.