Checkbox and global variable

jschuchert

Active Member
Licensed User
Longtime User
I created a global variable (intaz) in the process globals sub of the main module. I then dimmed a checkbox (chkazimuth) under global subs. I placed the checkbox on the main layout and used the following for a btnOK event within that layout. I also tried it within 'create activity....'
B4X:
sub btnOK_click
'other code
.
.
If chkazimuth.checked = true then intaz = 1 
end sub

In another module the code is:
B4X:
If main.intaz>0 then do something

Problem is that main.intaz doesn't know it is supposed to be 1. Since it is a global variable, I just assumed its value would be recognized in all modules. It works fine if the checkbox is within the activity being accessed. Since I want to use this approach as a way to set preferences, I need to know the correct procedure. Please straighten me out. Thanks all.

Jim Schuchert
 

jschuchert

Active Member
Licensed User
Longtime User
I believe I found the problem. I had the same layout for 2 activities and must have coded the wrong one. That is all I can think of. It works now. Thanks for looking.

Jim Schuchert
 
Upvote 0
Top