Controls and modules

Hi,
I’m just starting XOJO, but I have had experience with other languages. Hopefully this is not a silly question.

I have a window with a lot of controls, and I want to change various properties based on information from text files, etc. I made a method in a module to
test this out – because I will be doing the same thing for several controls. But, I’m having issues.

Right now I’m calling the method from the main window, and all I’m trying to do is get it to write some text to a text field.

Code is just for testing – no real purpose
//Call
rstr =x2(ktr)

//Module method x2(integer k1)

if k1 =3 then
TextField5.Text= genArray(3)
end if
return"X"

Error “This item does not exist” - TextField5. But it does(on the main window) – and it’s scope is public - method is global. Why can’t the method find the control?

Any help greatly appreciated.

Thanks,

hj

ps – I originally tried adding the method to the window. But when I did that, I couldn’t find a way to access the main window code. I’m hoping that’s just a concept I haven’t studied yet.

OK – figured out how to see my main code after I added a method to my window (headslap).

Can access TextField5.Text from a method in my window, but NOT from a method in the module.

Thanks,

hj

You can access the textfield from a method in a module, you just need to specify the window that the control is sitting on e.g. window1.textfield5.text.