How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

Function to return to us the object class that we want

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Function to return to us the object class that we want

    -- This brings us the page we want to search in. Is it a page or a dialogue
    function GetForm()
    FormName = Application.GetCurrentDialog()
    if FormName == "" then
    FormName = Application.GetCurrentPage()
    Form = Page
    else
    Form = DialogEx
    end
    return Form , FormName
    end

    function GetObjectClass(ObjectName)

    if type(ObjectName) ~= "string" then error([[ 'GetObjectClass' function The argument (opjectname)Must be of string type (enter the name of an existing object on the page)]],2) end
    local TypeObject = {
    Label , Paragraph , Image , Flash , Video ,Web , Input ,
    Hotspot , ListBox , ComboBox , Progress , Tree , RadioButton , RichText,
    CheckBox , SlideShow , Grid , PDF, QuickTime ,xButton ,Button , Plugin
    }
    Form = GetForm()
    local _typee = nil
    for i, v in pairs(Form.EnumerateObjects()) do
    if v == ObjectName then
    _typee = Form.GetObjectType(ObjectName)
    if _typee == 0 then -- object button
    _typee = TypeObject[21]
    elseif _typee == 40 then -- object Plugin
    _typee = TypeObject[22]
    else -- Other objects
    _typee = TypeObject[_typee]
    end
    break
    end
    end

    return _typee
    end

    --Example
    Button.SetText("Button1", "Hisham")

    object = GetObjectClass("Button1")

    x= object.GetText("Button1")
    Dialog.Message("",x)

  • #2
    You could use a lookup table, however it is still a bit cumbersome (see attached example). If I'm not missing the point here, you're trying to do something that can be done with my Object plugin.

    > https://www.imagine-programming.com/...ugin-ams8.html
    Attached Files
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment

    Working...
    X