Entry field in Windows

V+ discussions, tips and tricks, sample code, Q & A

Entry field in Windows

Postby molojose » Wed Apr 26, 2017 12:21 pm

Hello again Forum,
i am still programming some windows with the very old controller and I would like to know if there is a way to programm entry fields so I can enter names(strings) or numbers.
So far what I think I can do is to programm buttons for every possible letter and number. Kind of like a keyboard.
Any other idea?

Greetings
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: Entry field in Windows

Postby teknikiharmoni » Thu Apr 27, 2017 2:27 am

Have a look at he GETEVENT graphics command. Then ordinary keyboard works good in most, even rather dirty, environments. If you're into making o "touch" keyboard I think you just complicate both for you and the user. Another way is to have it via pendant keys, as old phones used to have, with one line for key explanation and one line for instructions/input or something like it. Then you also can make your own autofill, problem is to get a dictionary on text file...
Malmborgs Teknik i Harmoni
Anders Malmborg
Bråmåbovägen 120
792 90 Sollerön
+46 (0)70 54 22060
Fax +46(0)250 22060
TeknikiHarmoni.com
teknikiharmoni
 
Posts: 30
Joined: Mon Dec 08, 2008 11:57 pm

Re: Entry field in Windows

Postby molojose » Fri Apr 28, 2017 1:39 am

I am not sure if I really know what you mean by "via pendant keys". Do you mean the entry of letters and numbers using the handheld terminal?. If so, I think I rather let the user do the entries on the monitor window using the normal keyboard. I just don´t think that looks good and would like to avoid it because for that, they have to leave my window while making the entry.
So, is there no other way? No entry field?

greetings.
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: Entry field in Windows

Postby teknikiharmoni » Fri Apr 28, 2017 2:25 am

I'm not sure I understand what you have.
If you have a graphics window opened by V+ you can use the "GETEVENT(lun, mode) events[index]" command to detect mouse and keypress events in that window. Loop with no wait mode and mask off error -526 (no data received) and then check events[]. make sure you have a processor time release inside getevent loop like "WAIT.EVENT , .01" .
There are no ready to use "input boxes".
Monitor window and PROMPT command is an old, not so fancy, way to do it.
Malmborgs Teknik i Harmoni
Anders Malmborg
Bråmåbovägen 120
792 90 Sollerön
+46 (0)70 54 22060
Fax +46(0)250 22060
TeknikiHarmoni.com
teknikiharmoni
 
Posts: 30
Joined: Mon Dec 08, 2008 11:57 pm

Re: Entry field in Windows

Postby molojose » Fri Apr 28, 2017 6:51 am

alright then,
I went:
getevent (glun) event[]
if event[0] == 0 THEN

what do I do now?
supposedly:
key = ASCII value of key pressed

but I can´t seem to get a hold of "key"

Just to make sure. I need to be able to enter strings and display them in a window.

thanks for the help so far.
molojose
 
Posts: 17
Joined: Thu Feb 16, 2017 5:21 am

Re: Entry field in Windows

Postby teknikiharmoni » Fri Apr 28, 2017 8:58 am

You'll need in principle:

FSET(lun) "/event keypress"
$input="" ; clear input string
DO ; event loop
GETEVENT(lun,1) ; mode 1 means no wait so you don't hang program execution on waiting for an event

CASE event[0] OF

VALUE 0: ; keypress
CASE TRUE OF
VALUE NOT OUTSIDE(ASC("a"),event[1],ASC("Z"): ; valid characters
$input=$input+$CHR(event[1])
GTYPE(lun) x, y, $input

VALUE event[1]==13: ; <Return/Enter>
EXIT ; exit event loop

END ; CASE TRUE...

END ; CASE event[0...

WAIT.EVENT , 0.01 ; release processor time - important!
UNTIL FALSE ; event loop
Malmborgs Teknik i Harmoni
Anders Malmborg
Bråmåbovägen 120
792 90 Sollerön
+46 (0)70 54 22060
Fax +46(0)250 22060
TeknikiHarmoni.com
teknikiharmoni
 
Posts: 30
Joined: Mon Dec 08, 2008 11:57 pm


Return to V+

Who is online

Users browsing this forum: No registered users and 3 guests

cron