IonicWind Software

Creative Basic => GUI Programs => Topic started by: tbohon on October 20, 2008, 01:44:59 PM

Title: Text Box
Post by: tbohon on October 20, 2008, 01:44:59 PM
I'm trying to figure out how to know when a user hits <cr> after typing in a text box.  I need to grab whatever it is that was typed to evaluate it.

Thoughts?

Tnx.

Tom
Title: Re: Text Box
Post by: LarryMc on October 20, 2008, 02:49:32 PM
Tom
Might be something here that helps you.

http://www.ionicwind.com/forums/index.php/topic,2565.msg21810.html#msg21810

Larry
Title: Re: Text Box
Post by: tbohon on October 20, 2008, 03:28:51 PM
Thanks, Larry - I'll see if I can twist, err, tweak that code to do what I need to do.

Best,

Tom
Title: Re: Text Box
Post by: tbohon on October 20, 2008, 03:57:19 PM
Larry:

Works like a charm ... !!!   ;D

Thanks again.

Tom
Title: Re: Text Box
Post by: tbohon on October 22, 2008, 07:24:26 AM
Follow-on question:

I have the issue above resolved.  However, I want to be able to start the 'end program' activities (saving any changed files, cleaning up, etc.) when the user types 'quit' in the text box.  So far I have the command line parsed out and am examining the first value (which is the command, 'quit' in this case).  However, when I find 'quit' I can't figure out how to make the program think that the 'exit' button (or the 'x' button in the upper right) has been clicked.  I tried to simply set run to zero (0) and return but that event isn't trapped and doesn't do anything for me.

Note that I have an 'Exit' button and it works just fine by setting run to zero ...

Maybe I need to throw the 'close window' event somehow ... ?  Any thoughts? 

Tnx in advance.

Tom
Title: Re: Text Box
Post by: LarryMc on October 22, 2008, 07:33:13 AM
CLOSEWINDOW MyWin

or SENDMESSAGE MyWin, @IDCLOSEWINDOW,0,0  maybe

Larry
Title: Re: Text Box
Post by: tbohon on October 22, 2008, 09:00:07 AM
Larry:

I think this gets me closer but it still doesn't do anything - seems to want one more parameter (per the help file) ... and I don't know what to put there.

Here's the window code and the SENDMESSAGE line ...

' Declare window and controls, set color, center window on open
WINDOW w1,0,0,810,582,0x80CB0080,0,"Window w1 Title Goes Here",main
CONTROL w1,"RE,,29,26,747,477,0x50800804,1"
CONTROL w1,"E,Edit1,29,517,543,22,0x50800080,2"
CONTROL w1,"B,Print,614,519,70,20,0x50000000,3"
CONTROL w1,"B,Exit,705,519,70,20,0x50000000,4"

SETWINDOWCOLOR w1,RGB(176,196,222)

CENTERWINDOW w1

...

SENDMESSAGE w1,@IDCLOSEWINDOW,0,0,


I tried putting all of the control numbers (one at a time) at the end of the SENDMESSAGE but it just beeps at me.

ARRGHHHHH!!!  :)

Tnx.

Tom
Title: Re: Text Box
Post by: LarryMc on October 22, 2008, 10:01:10 AM
SENDMESSAGE shouldn't have that last comma.

Besides I tried it and I couldn't get it to work anyway.

In the handler where you are catching the "quit" text I would call a subroutine to do all your file saving, etc. and then just use CLOSEWINDOW w1

Maybe Graham or Sapero or Paul knows a better way.

Larry
Title: Re: Text Box
Post by: Ionic Wind Support Team on October 22, 2008, 10:11:18 AM
Send it a WM_CLOSE message (0x10)

SENDMESSAGE w1,0x10,0,0

Title: Re: Text Box
Post by: LarryMc on October 22, 2008, 10:21:19 AM
How come SENDMESSAGE w1,@IDCLOSEWINDOW,0,0 wouldn't work?

Larry
Title: Re: Text Box
Post by: aurelCB on October 22, 2008, 10:33:09 AM
I use in my interpreter this
after parser:

SELECT command
    CASE "QUIT"
     GoTo Quit()
ENDSELECT

SUB Quit
CLOSEWINDOW win
RETURN

or if you want finish main program:

Quit:
CLOSEWINDOW win
END
Title: Re: Text Box
Post by: Ionic Wind Support Team on October 22, 2008, 10:35:54 AM
Larry,
@IDCLOSEWINDOW is a private message and has a different value than WM_CLOSE.   Technically it should work, but since it didn't I suggested sending it the real close window message, which will be mapped to @IDCLOSEWINDOW internally. 

Paul.

Title: Re: Text Box
Post by: tbohon on October 22, 2008, 11:00:42 AM
Paul:

Works like a charm.  I still need to study it a bit but I think I understand what's happening.

Larry and aurelcb:

Thanks for your help.  The willingness of members here to jump in and suggest fixes is one of the strengths of this forum - we all learn every time this happens.

Maybe some day I can actually help folks rather than always asking questions ...  :o

Best,

Tom
Title: Re: Text Box
Post by: LarryMc on October 22, 2008, 12:53:16 PM
Tom

What little I know has come from the people on the forums.

I know I've tried Paul's patience a few times but he's been able to teach me a little about the internal workings of windows.

I rely on Paul and Sapero to bail me out all the time.

The EBasic source code also helps a lot.

Larry