With a dynamic array, is there a built-in function to check whether a specified element exists?
Also, the GETMEMBER() function returns the value of a dynamic array element or an alternative value if the element does not exist.
The Lianja.getElementByID(item) method and its (quicker to type) synonym Lianja.get(item) allow you to call methods and get and set properties of the visual elements in the Lianja Object Model (LOM) hierarchy, from App through Pages and Sections to Formitems, Gadgets and Columns.
Are these two the same? I have had some strange results using the first syntax
loPge = Lianja.get("page1") loSec = loPge.section1
loSec = Lianja.get("page1.section1")
loSec = Lianja.get("Purchase_Orders.section1") loSec.add()
but this doesn’t:
loPge = Lianja.get("Purchase_Orders") loSec = loPge.section1 loSec.add()
The normal approach to referencing UI elements is to use Lianja.get() with dotted notation for page.section.formitem.
You get an object reference then set its attributes and call it’s methods in the way I previously described. This is scripting language independent.
I’m using canvases a lot in my app for the added flexibility they bring. In a desktop app, you can access (for example) the text in field1 of a canvas with
var myvar = Lianja.get("page1.section1.field1").text
This makes me think the feature isn’t implemented in non-desktop apps? If not, is there a different way of doing it? I find this functionality really useful in a lot of ways, for example setting the default value of a textbox dynamically based on what the user entered on a previous page.
in your case here you would name field2 something sensible and just reference the properties as field2.property.
Also look at the toJSON() method on sections if you want to gather all data off a form to send to a server side procedure for processing. Use this in conjunction with base64_encode() and base64_decode() on the server.
cat = Lianja.get('Advanced_Search.section1').field13 val_cat = cat.text cat.text Variable was expected!
That is invalid syntax.You should use.
cat = Lianja.get('Advanced_Search.section1.field13')
Lianja v2.1 includes two new methods on Pages, Sections and FormItems (fields and gadgets).
These are setAttribute(name, value) and getAttribute(). These methods handle all attributes as documented and described in the MetaType Editor.
Use Lianja.get(“page1”).setAttribute(“title”, “page title”) for pages.
Use Lianja.get(“page1.section1”).setAttribute(“title”, “section title”) for sections.
Use Lianja.get(“page1.section1.field1″).setAttribute(” caption”, “field caption”) for formitems.
Note that there are shortened forms of these also, setAttr() and getAttr() respectively.
I have a custom commandbutton class that I want to reuse. Meaning, I have several buttons created using “Mybuttons”.
I want to pass a unique id to click event so that I know which button was clicked.
Something like below.
define class mybuttons as commandButton proc click( param1) do case ..... endcase endproc enddefine
create your button and assign it a unique id. In the click event you can then reference this.id.
this.name works fine.
When an App is open in App Builder, is it and it’s objects available in the Console?
Wher is .hwnd properties in Form object ?
How do use hwnd to get the id for a section, or a gadget?
I need to redirect video output to a window.
hwnd is a artifact of the (old — WPF and Silverlight don’t have hwnd, but have hwnd interop) windows technology. The purpose was to give a near-object reference in a non-object-oriented environment.
In LianjaDemo, from the console:
lo = lianja.get("customers") ? lo.hwnd
May I know how I can get an object reference to the Current App, Current Page, Current Section, Current field and Current Gadget in my delegate?
In other words, is there something similiar to This and Thisform in VFP for the App, Page, Section, Field and Gadget
loMyControl = Lianja.activepage.activesection.activecontrol
For active page:
oactivePage = Lianja.activePage nameactivePage = Lianja.activePage.id
oactiveSection = Lianja.get("mypage").activesection Lianja.localstorage.setItem( key, value )
Lianja.sessionstorage.setItem( key, value )
And the corresponding getItem() on these work between desktop and web//mobile
_screen is VFP desktop specific and does not exist in the web client.