Switching between screens

mozaharul

Active Member
Licensed User
Hi,
In the attached program I used two menu items to switch between screens generated at run-time. At the start the left menu option is “Close” and right option is “Next >”. Clicking the “Next >” option changes the “Close” menu option to “< Back” and at the last screen the “Next >” menu option becomes “Save” option, the left option is still “< Back”. Clicking the “< Back” option any time will take to the previous screen. The “< Back” menu option again becomes “Close” when switch back to the first screen.

The program runs fine in the desktop even in the device without using the soft keyboard. But when keyboard is used in the device then I can not move back and forth using the menu options.
The place to look for any problem is :
the “Sub Mclose_click” and “SubMnext_Click” event in the program.
I set the message and have seen that without using the keyboard on the device highest value generated for variable “m” is 2 (which is OK) but when keyboard is used and try to switch back or forth, value generated for variable “m” is more than 1000 and keeps increasing in each click of “Next >” menu option. Also tried to use hardware library (hardware_SIPchanged event) but could not make it out.

Regards,
 

klaus

Expert
Licensed User
Longtime User
You are using the variable m at two places in the hw_SIPChanged routine and in the Mclose_Click , Mnext_Click routines!

Are you shure that the variable m in SIPChanged is same as the other one you use in the Mclose_Click and Mnext_Click routines.

You should use another variable name in routine SIPChanged.
When you use local variables in subroutines, I suggest you to declare these with a Dim keyword at the beginning of the routine like.
Sub hw_SIPChanged
Dim mm, h

Best regards.
 

mozaharul

Active Member
Licensed User
Thanks for the suggestion. Since I declared the variable "m" in the global section, then if I'm not wrong, variable "m" is same used in the mentioned subs.

best regards,
 

agraham

Expert
Licensed User
Longtime User
As Klaus pointed out you seem to be using the global variable m for two different incompatible purposes. In Mnext_Click you seem to be using it as a Form progression counter but in hw_SIPChanged you are using it to hold a calculated height in pixels - this is where the big number comes from. Surely you need to use a local variable in hw_SIPChanged and not upset a global variable used for an entirely different purpose!
 

mozaharul

Active Member
Licensed User
My best regards to both of you, klaus and agraham. I'm ashamed for the silly mistake I made.
 
Top