• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

commandAction - newbie

 
Arnab Sen
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anyone tell me what am I doing wrong here ?

The program compiles and runs perfectly but the commandAction is being called repeatedly.

I am using the WTK2.2 final version.




Regards,
Arnab
[ February 04, 2005: Message edited by: Arnab Sen ]
 
Arnab Sen
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh and yes, I am using J2SE 5.0

Regards,
Arnab
 
Arnab Sen
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this some kind of BUG in WTK ? I have been looking everywhere to understand this problem but it seems that commandAction is invoked only when any button is pressed.

So if I select a command once, commandAction will be onvoked only once.

But I can see that the commandAction is being called continuously.

Any pointer please ?

Regards,
Arnab
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I see after you press 'ok' on the form you will get on the console:

insiide ok
iinside ok after Alert is displayed

Then you will see the alert and every time you press 'ok' on the alert you will see the same two lines and the alert will stay on-screen. This is because you do not take a different action based on which display you are in.


Yuri
 
Arnab Sen
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yuri,

Thanks for your reply.

That's right. I am supposed to see those 2 printlns everytime I press OK. But as I had mentioned, these statements are being printed continuously even without pressing ANYTHING.

Regards,
Arnab
 
Arnab Sen
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I mean continuously being printed even without pressing ANYTHING!

Arnab
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ran it in WTK 2.1 - when I press 'ok' in the form I get the two lines printed twice. Then each time I press ok in the alert the two lines get printed once.
Next I changed the code in commandAction as I wrote it in my previous post and what happens when I press 'ok' in the form is that it goes to the alert (I see
'iinside ok after Alert is displayed') and then it immediately shows the form again. It looks like if you use the same Command in the form and the alert it gets 'clicked' automatically after you change the display.

Probably you should use different instances of Command.

Yuri
[ February 06, 2005: Message edited by: Yuri Magrisso ]
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I tried with different instances of Command and I am still getting the same result. Obviously the Command in the alert gets 'clicked' automatically anyway.
Quite strange...
 
Arnab Sen
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yuri,

Found the problem. Its to do with Alert Timeout. I guess by default Alert is called after every few seconds.

WHen I changed the Alert Timeout value to FOREVER, then the problem is resolved.

This problem will not happen with anything else e.g. with Forms etc...

Regards,
Arnab
 
Yuri Magrisso
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice to know
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic