aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
forum.gifForum - iziBasic - Topic #1615

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

active  Topic # 1615  getfocus

02/07/2008 @ 13:57
by Gary

Anonymous



I am currently working on a calculator with a couple of fields to store numbers in when a number button is pressed.

I will need to get the ID of those fields to put the numbers in the correct field, but I can't use GETFOCUS in the number button because the ID will change as soon as the number button is pressed.

I tried to put something in the event handler, but it's not working.

Here is some code:

_EventsLoop:
REPEAT
%EVT%=WAITEVENT
SELECT CASE %EVT%
CASE 1 'this is the 1 button
GOSUB _ONE
CASE 15 '15 is an ID of a field
GOSUB _FLD
END SELECT
UNTIL %EVT%=-1
RETURN

_FLD:
A$="15"
UPDATEFIELD #15,A$
RETURN

_ONE:
RETURN

I figured when I touch the field ID#15 to set its focus it would go to _FLD

Is there a better way?

Thank
Gary
Write to Gary   Post an answer  Top

[]   


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1
--------
04/07/2008 @ 08:51
by Gary

Anonymous

visitor
I have tested GETFOCUS in couple of different pieces of code and I get the same result "0". I seems that GETFOCUS isn't working or I am coding it wrong.

Here is a sample:

First I click on the Field in question to set its focus.

Then I click the one button.
_ONE:
F=GETFOCUS
SETFONT 2
COLOR 1
F$=STR$(F,0)
GPRINT F$,60,1
RETURN

It prints a "0" to the screen.

Then I tried this

CASE 15 '15 IS A FIELD
F=GETFOCUS
END SELECT
UNTIL %EVT%=-1
RETURN

_ONE:
SETFONT 2
COLOR 1
F$=STR$(F,0)
GPRINT F$,60,1
RETURN

Same result.

Am I using GETFOCUS wrong?

  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2
--------
06/07/2008 @ 03:34
by Gary

Anonymous

visitor
I worked it out last night. I added a pen down event to my event handler and went from there.

CASE 1000
GOSUB _SETUP
CASE 1001
GOSUB _MENU
END SELECT
UNTIL %EVT%=-1
RETURN

_SETUP:
G=GETFOCUS
C=0
L=LEN(N$)
REPEAT
N$=N$+" "
UNTIL L=5
RETURN

Gary
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 3
--------
06/07/2008 @ 17:47
by aldweb

Anonymous

visitor
Hello Gary,

GETFOCUS should return the focus of the last managed object, for example the button you just pressed.

I think to remember that fields do not return a GETFOCUS value because there is no event generated by a field in iziBasic.
I would have to test a little bit further to check this...

Cheers,
aldweb
Write to aldweb   Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 4
--------
07/07/2008 @ 08:16
by Gary

Anonymous

visitor
I did test it and it does return a field value, but it does not return a button event.

My first attempts all return 0. No button had a value of 0, they were all 1, 2, 3...

My last setup worked and I can prove it was returning a field event. Once I started getting real events I set it up to print the value on the screen and it print all the field events, but return a 0 when a button was clicked.

My last post explanes my setup, I added a down pen event in the event handler and from there I added g=getfocus. The next thing I did to test this was to made a button start the process. Instead of the orignal purpose I made it print the result of the getfocus to the screen it print every field I had defined, but no buttons.

Thanks
Gary
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 5
--------
11/07/2008 @ 12:54
by aldweb

Anonymous

visitor
Hello Gary,

I did test it and it does return a field value, but it does not return a button event.

You are right, this is it!
GETFOCUS returns which field has the focus since fields do not send an event when they've got the blinking cursor for input, this was the purpose for creating this statement!
Buttons and other objects return an event. Knowing if they have the focus or not is therefore usually not needed (and was not possible at all before Palm invented this blue ring stuff for one-handed navigation in the recent devices).

Cheers,
aldweb
Write to aldweb   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^