I navigate to a different page using Lianja.activePage = page2 & the new page opens just fine.
I want to do some things when the page loads (move to a desired record or start add mode etc.). A few questions:
– I did some tests and page load/init/ready all fire when the app starts and never again, am I right in assuming that all pages load up at the start of the app?
– What event could I use to setup a page when navigating to it as above?
Events are called in the order init, load, ready and then activate for the active Page/Section.
When you navigate to a Page, its activate event is called.
In Lianja v2.1 when the App Inspector is active, events are logged in the “Events” tab in both development view and runtime view.
In versions prior to v2.1 the events were only logged in runtime view. This provides more useful information when optimizing the speed of an App.
The object is available in the READY event, which fires before the Activate, so you should be able to access it there also if you have a need.
I think it’s better to indicate in which event additems method can be used to load initial value in the list or combo item when the app starts.
Use the ‘ready’ event. During development in the Lianja App Builder, the ‘ready’ event is called when the App is loaded, so just save and reload the App to force the ‘ready’ event to be called and see your new code.
Try it with a command that does not change the focus – valid() is called before the control has lost focus. e.g. instead of messageBox(“…”) or wait window “…”
where I should place the code to initially disable some of the buttons in canvass section upon running/opening the project?
In the section “Ready” delegate.
Is it possible to change the textbox input mask based on the selected combo box value?
This doesn’t seem to work in the Web App View.
case "CLIENT NUMBER (XX####)":
txtsearch.inputmask = "^^9999";
case "PHONE (##########)":
txtsearch.inputmask = "9999999999";
case "CLIENT NAME":
txtsearch.inputmask = replicate("!",30);
When the web app view is loaded, the input mask remains the same as the last reference used in the pages workspace.
Try using the ‘Change’ (changed()) delegate instead of ‘Interactive Change‘.
The events are called in the order:
from the App: (mnemonic help: ILRA)
– First Page
– First Section of the first Page
— The Fields the first Section
– Section II of the first Page
— The Fields of the second Section
– Second Page
If a variable is required for particular component would normally be declared / initialized in the “init” or “init” earlier in the hierarchy.
The database is available for events of “load“.
For visual properties, such as section.collapse (), wait for the internal load and display have been completed – put them in the “ready” event for the component.
The Class type is important here. If you have a VFP Custom class – e.g. you are running an imported scx as an scp – then the order is as Cyril says and load comes first (more here).
If you are talking about the Lianja Object Model (LOM): Pages, Sections, Fields/Gadgets etc. then load follows init.
Lianja where it’s start ?
first Page in the App is the starting point in terms of display. Prior to this, the setup.prg (if exists) will be run, the init, load and ready events will be run (http://www.lianja.com/community/show…ence-of-events) along with any database open event / table open trigger scripts. The first visible Page is also dependent on Page read roles (http://www.lianja.com/community/show…ence-of-events) – the user will see the first Page they have permission to ‘read’.
Which event is best suited for deinitializing variables / setting flags etc?
Destroy comes last after Unload – Page1 Unload, Page1 Destroy, Page2 Unload, Page2 Destroy, … , App Unload, App Destroy. Public variables are released and the database is closed after the App Destroy delegate has run.
The events are called in that order: init, load, ready, activate with the App first:
– first Page
— first Page’s first Section
— first Section’s Fields
— first Page’s second Section
— second Section’s fields
– second Page
If a variable is required by a particular component it would normally be declared/initialised in its init or the init earlier in the hierarchy. The database is available to the load events. For visual properties, such as the section.collapse(), wait until the internal loading and display have completed – put them in the ready event for the component.
The ‘Change’ (xxx_changed()) delegate is called when a record is modified – after ‘After Data Update’ (xxx_afterupdate()).
The ‘After Data Changed’ (xxx_datachanged()) delegate is called on Form Sections after the data is read – as you move through the records.