Editbox and other objects

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Editbox and other objects

Post 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.
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Editbox and other objects

Post 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.
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Editbox and other objects

Post 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
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Editbox and other objects

Post 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.
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Editbox and other objects

Post by mol »

You can use standalone button and set its action to release editbox.

I'm glad to help you!
Marek
cocoking
Posts: 46
Joined: Tue Jun 15, 2010 1:15 pm
Location: Malabang, Lanao del Sur

Re: Editbox and other objects

Post by cocoking »

Thanks, Marek, for the suggestion.
Post Reply