1. Another How-to Question

Here is what I want to do this time:

Display a prompt and recieve a string in response. Nothing unusual
about that. Here's the catch. I want to display editable text on the
screen. Example

What is your name: John Q. Public

I want all of that to be displayed by my program and the user be able
to backspace/change John Q. Public to their name. For example the
screen would now look like:

What is your name: John A. Washington

Any ideas? Is this even possible?

P.S. In case you can't tell, I've been switching between three
different programs :~).


~~>Joseph Martin
~~>Personal: joe at cyber-wizard.com
~~>Web:  jam.net at poboxes.com
~~>URL: http://users.exis.net/~jam/

new topic     » topic index » view message » categorize

2. Re: Another How-to Question

> Here is what I want to do this time:
>
> Display a prompt and recieve a string in response. Nothing unusual
> about that. Here's the catch. I want to display editable text on the
> screen. Example
>
> What is your name: John Q. Public
>
> I want all of that to be displayed by my program and the user be able
> to backspace/change John Q. Public to their name. For example the
> screen would now look like:
>
> What is your name: John A. Washington

My Euphoria is bad, so I'll give you the algorithm in Commodore 64 BASIC.
Why? Because I have written and rewritten this particular code SO many times
on that particular platform.

10 t$="John Q. Public":p$="What is your name? "
20 print p$;t$;:poke 204,0:rem this is a 64 thing, ignore it
30 get a$:if a$="" goto 30
40 if a$=chr$(20) and len(t$) then print a$" "a$;:t$=left$(t$,len(t$)-1):
   goto30:rem chr$(20) is C64 BKSP, so make it 0x08/0x7f for PC
50 if a$=chr$(13) and len(t$) then poke204,1:print " ":end:rem ignore
   the poke 204,1 again
60 if a$<" "ora$>"z" goto 30:rem character codes 32-90 in PETSCII
70 if len(t$)>30 goto 30:rem arbitrary length of string
80 print a$;:t$=t$+a$:goto 30

Yeah, I realize this is cryptic in parts, but the algorithm is here.
Basically, all it is is a bulletproof shielded INPUT routine.
If you want an exhaustive breakdown, I can do that too, but I think it
explains itself pretty well.

Cameron Kaiser
http://www.sserv.com/
spectre at sserv.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: Another How-to Question

> Display a prompt and recieve a string in response. Nothing unusual
> about that. Here's the catch. I want to display editable text on the
> screen.

I believe the easiest way would be to POKE the default text into the
keyboard buffer before requesting the user input...

 __
    Snowgen
     snowgen at wf.net
     http://www.wf.net/~snowgen/

new topic     » goto parent     » topic index » view message » categorize

4. Re: Another How-to Question

Cameron Kaiser <spectre at ODIN.EGATE.NET> wrote:

> > Here is what I want to do this time:
> >
> > Display a prompt and recieve a string in response. Nothing unusual
> > about that. Here's the catch. I want to display editable text on the

I'm busy at this moment with a funtion edit_field() for a
database program which will do this with the WordPerfect key format.

It inserts, deletes under cursor, delete left from cursor, go to end
of line, goto begin of line, jump word left/right. Still to come
delete word, overwrite.

I don't know how long you can wait it needs some refinement. If you
are in a hurry you can get it untested and with some function
omissions, and maybe still bugs.

Marcel Kollenaar

new topic     » goto parent     » topic index » view message » categorize

5. Re: Another How-to Question

Oops, my solution was ment for Joseph Martin, Sorry boys

Marcel Kollenaar

new topic     » goto parent     » topic index » view message » categorize

6. Re: Another How-to Question

Sorry I didn't make that 100% clear. I want to try to make this a
text-based program only. I will in all probability make it GUI at a
later time, but for now just text-based. Thanks for the routine
David it looks like what I need.

Just for kicks, how would I poke the data into the keyboard
buffer like Snowgen and Cameron Kaiser suggested? I would also like
to play around with that.


~~>Joseph Martin
~~>Personal: joe at cyber-wizard.com
~~>Web:  jam.net at poboxes.com
~~>URL: http://users.exis.net/~jam/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu