Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2010
    Posts
    529

    Variable assignment

    Hi to all and hope everyone is enjoying the season!

    I was looking through some old samples and came across this. In a "Drag & Drop" app, a button on the page had been assigned to a variable:

    On Enter
    Code:
    sObject = this;


    How does this variable assignment work and what is the scope of using it? Can a variable be applied to an object in this way myVariable=this on any type of object?

    I tried to look up more info in the Manual and the Lua manual, but didn't get anywhere.

    Thanks for any insight.

    Cheers,
    Dean

  2. #2
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    this simply references the object name upon which it is used.

    So, if you have a checkbox named "CheckBox1" and a script on it that stores this in a global variable, that global will now contain the string "CheckBox1".

    Hope that helps.
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  3. #3
    Join Date
    Apr 2010
    Posts
    529
    Thanks CS.

    How would you assign this variable name? In your example of the CheckBox1, where would you assign a variable to this item?

    Alternatively, if I had a Label "Label1", how would I assign a variable to "Label1" (using the myVariable=this idea) without entering, clicking, etc the label? Or is myVariable=this used more so when applying a variable name to an object during an action/event?

    And lastly can you define the variable as a Local variable this way as well?

    I don't have a particular usage in mind, just trying to understand things a little better

    Cheers,
    Dean

  4. #4
    Join Date
    Jun 2007
    Location
    Delphi II
    Posts
    1,534
    PHP Code:
    local MyVariable this
    or

    PHP Code:
    MyVariable this
    Action Plugins
    AllOn | Box | Class | Code | Cursor | DXML | Error | Frames | GlobalPaths | Group | INIPlus |KeyBind | KeyLock | MathEx | Menu | Name | Project | Resize | StatusBar
    Download

  5. #5
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Dean,

    Is this in the scrolling script you were talking about? this is no keyword, it's also a variable (local to the scope it is in), however if you make a global variable (so no local keyword) you will be able to use it everywhere.
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts