B4X FEED Passing a reference to an object

اطلاعات موضوع

درباره موضوع در تاریخ, در دسته b4xfeed ایجاد شده و آغاز کننده آن practicalsoftمی باشد و موضوع آن: Passing a reference to an object است. این موضوع تا کنون 26 بازدید کننده و, 0 پاسخ داشته و 0 بار پسندیده شده...
نام دسته b4xfeed
نام موضوع Passing a reference to an object
آغاز کننده موضوع practicalsoft
تاریخ شروع
پاسخ‌ها
0
بازدیدها
26
پسندها
0
آخرین ارسال توسط PracticalSoft
Jun 6, 2020
11,559
4,422
Hi, Guys
I am having a problem - I am using B4X pages and have setup an object to store information used by may classes and pages in my application.

In the App this global object (with a public attribute) resides in the B4XMainPage, however when testing is can reside elsewhere.
So I have tried to pass a reference of this object in various calls to pages/classes, attempting to avoid using explicit code like
B4XPages.MainPage.ObjectName.ElementName = newDate (i.e. when testing it can reside in one of the test modules).

Unfortunately, using a reference does not update the global object (it appears to only update a local copy of the object) - the explicit code does however work.

I have used this method of passing a reference to an object in other languages and it works well, and by not using explicit code to access a fixed global object makes the classes more re-usable and easier to test.

I hope you can understand my question, if so what I am doing wrong?


Dave Morris

 

عقب
بالا