UIForm.activefield() returns allways NULL

Discuss OrbForms Designer and PocketC Architect

Postby Rudi on Wed Apr 18, 2007 4:24 am

this confuses me ...
I have a simple Form with three Fields and one Button, the Handler for Button is this:

handler button1004.onselect() {
//TODO: handle event
UIField *fld;
fld = mainForm.activefield();
alert("no field");

on Simulator and Emulator, if the cursor is in any of the three fields, i see the UIField.id in the alert,

on a REAL Livedrive, i ALWAYS see "no field". Emulator and Simulator lets the cursor blinking in the field by pressing the Button, the real LifeDrive does it not, the cursor disapears after pressing the button.

This confuses me too:
if i have group-buttons with rectangle (i testet it only with recttangle) and i say: UIButton.visible=false; then the text of the button go unvisible, but the Frame is visible (i see empty buttons). if i say visible=true, the text and the frame is visible. Real Lifedrive, Emulator and Simulator do this.

My Orbformsversion is: 4.1.2 build 232

Whats wrong?
Best regards,
Posts: 33
Joined: Thu Feb 12, 2004 2:42 pm
Location: Germany

Postby FrankG on Wed Apr 18, 2007 3:47 pm

I guess it makes sense that if you change the focus to a button by tapping it, no field will be active so I'd expect a null result. But what's going on with the simulator? It might just be whacky behavior in an imperfect simulation.

One thing you might try to see how well the method is working is to issue a timer event every fraction of a second and in the timer event handler, put the result of the activefield method into a 3rd field object. As you tap between field1 and 2, you ought to see an update in field 3 that reflects the currently active field.

Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm

Postby Rudi on Wed Apr 18, 2007 5:28 pm

xForm.activefield only makes sense, if you press a button or a menue. To remember the field by saving "what field" in a variable is not a good idea, because you dont know in wich field the cursor blinks, if there is no modify, also a empty field or a field with no changes after tap in.
But i MUST know, in what field the cursor is - BEFORE any modifing of the field.text.

At evening at home i testet this problem with various devices, and this is the result:

Emulator & Simulator: Run perfect
Emulator=m505 Roms, Simulator=garnet sim from developer.access, lifedrive sim, sony sim - testet all simulators, same result, perfect run ***)
real Palm Lifedrive: does not run
real Lifedrive after hardreset: does not run
real Sony ux50, run perfect
real Palm III, run perfect
real Palm m505, run perfect

*** with this little difference: the Lifedrive simulator hangs after 3-5 tries, must reset. other Simulators (and Emulator) does never hang up.

Is this a Lifedrive problem ????

Posts: 33
Joined: Thu Feb 12, 2004 2:42 pm
Location: Germany

Postby samps on Wed Apr 18, 2007 10:27 pm

A small addition to complete the picture:

When i run your code (as copied and pasted from your initial posting) on the Palm Emulator with a Vx ROM, the alerts for field 1002 and 1003 are correct. For field1001 I always get the "no field" error.
Additionally added fields (1005 and 1006) work as intended, having their ID displayed in the alert.
When I delete the field that causes an error instead of having its ID displayed, the behaviour is then displayed by the next field in line, field1002.
The behaviour is consistent on my real tungsten T as well as on the Simulator playing Tungsten T

Ubuntu user #82
Posts: 143
Joined: Tue Feb 20, 2001 12:33 am
Location: Australia

Postby FrankG on Fri Apr 20, 2007 1:36 pm

hmmm.... strange indeed.
I guess it would be interesting to hear from Dewey; how should activefield be working when a button gets tapped?

It makes sense to me that there is no active filed but I'm willing to find out I'm wrong! :) The help text is not conclusive.

At the least we ought to expect consistent behavior in emulators, simulators, and real devices.

It reminds me of an application I have with a scrollable table of data, produced with a Draw object like:
Name1 number1 position1
Name2 number2 position2
Name3 number3 position3

What I had to implement was to make the text edit enabled when a name, number, or position is tapped. I'm not sure if activefield would be able to help implement that function -- unless I checked for an active file in a timer handler. I ended up putting a gadget over the table, reading tap (x,y) positions, and figuring out what text that represented and enabling a field object for editing.

Good luck Rudi,
Posts: 210
Joined: Thu Jan 23, 2003 7:58 pm

Postby dewey on Sat May 05, 2007 11:57 pm

activefield() asks the OS for the control with focus. If there is such a control and it is a field, it is returned. The difference in behavior between emulator, simulator, and device is caused by the OS having a different behavior (perhaps because they are running different OS version).

I would expect that pressing a button would give that button focus. On newer devices designed for navigation using just the 5-way (where the 5-way can change the focus), I expect this to work. On older devices (and the OS running on an emulator), this navigation model didn't exist. Thus, I expect that the field will still have focus when you press a button.
Site Admin
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests