Topic
  • 6 replies
  • Latest Post - ‏2013-11-08T15:20:53Z by llandale
EHcnck
EHcnck
110 Posts

Pinned topic set get() to Buffer

‏2013-11-07T16:47:30Z |

Hello,

what is the proper way of setting "get()" resultx directly to a buffer? below was the only way I was able to do it, but it does seem correct. Thank you

DBE commandline

Buffer cmdStr = create ()
cmdStr        = "" get(commandline)

  • llandale
    llandale
    3035 Posts
    ACCEPTED ANSWER

    Re: set get() to Buffer

    ‏2013-11-07T18:28:01Z  

    cmdStr = (string get(commandline))

  • llandale
    llandale
    3035 Posts

    Re: set get() to Buffer

    ‏2013-11-07T18:28:01Z  

    cmdStr = (string get(commandline))

  • GregM_dxler
    GregM_dxler
    166 Posts

    Re: set get() to Buffer

    ‏2013-11-07T18:59:34Z  

    Take a close look at the dxl reference manual

    get(element or option)

    Declaration

    {string|int|bool} get(DBE 
    element [,int 
    index])
    

    Note that the string|int|bool is not an option, it is mandatory.  Should always be included.  If it were optional, it would have brackets [ ].

    Sometimes it's the little things that bite us.

    Hope this helps,

    Greg

  • EHcnck
    EHcnck
    110 Posts

    Re: set get() to Buffer

    ‏2013-11-07T19:07:33Z  
    • llandale
    • ‏2013-11-07T18:28:01Z

    cmdStr = (string get(commandline))

    thx,  I tried casting initially must had the parentheses wrong.

  • llandale
    llandale
    3035 Posts

    Re: set get() to Buffer

    ‏2013-11-07T19:57:12Z  

    Take a close look at the dxl reference manual

    get(element or option)

    Declaration

    <pre class="pPreformatted">{string|int|bool} get(DBE element [,int index]) </pre>

    Note that the string|int|bool is not an option, it is mandatory.  Should always be included.  If it were optional, it would have brackets [ ].

    Sometimes it's the little things that bite us.

    Hope this helps,

    Greg

    I think "get(DBE)" can caste itself most of the time via context.  See below.  I caste it above since you can put an "int", "bool", or "string" into the Buffer so it would not know which one.

    DB db
    DBE dbeS, dbeB, dbeI

    void clbkRead(DB dbXX)
    {
     string s = get(dbeS)
     bool  b = get(dbeB)
     int  i = get(dbeI)

     print s "\t" b "\t" i "\n"
    }

    db = create("Get")
    dbeS = field (db, "Field", "Init", 10)
    dbeB = toggle(db, "Toggl", true)
    dbeI = slider(db, "Slider", 10, 0, 20)

    apply(db, "Check", clbkRead)
    show(db)

    -Louie

  • GregM_dxler
    GregM_dxler
    166 Posts

    Re: set get() to Buffer

    ‏2013-11-08T14:16:43Z  
    • llandale
    • ‏2013-11-07T19:57:12Z

    I think "get(DBE)" can caste itself most of the time via context.  See below.  I caste it above since you can put an "int", "bool", or "string" into the Buffer so it would not know which one.

    DB db
    DBE dbeS, dbeB, dbeI

    void clbkRead(DB dbXX)
    {
     string s = get(dbeS)
     bool  b = get(dbeB)
     int  i = get(dbeI)

     print s "\t" b "\t" i "\n"
    }

    db = create("Get")
    dbeS = field (db, "Field", "Init", 10)
    dbeB = toggle(db, "Toggl", true)
    dbeI = slider(db, "Slider", 10, 0, 20)

    apply(db, "Check", clbkRead)
    show(db)

    -Louie

    Yup, I see, buffer doesn't know which type it should be using.  Others, are already declared what type it is.  I guess it would still be confused if you used autodeclare for the variables.

    Thanks for the clarification,

    Greg

  • llandale
    llandale
    3035 Posts

    Re: set get() to Buffer

    ‏2013-11-08T15:20:53Z  

    Yup, I see, buffer doesn't know which type it should be using.  Others, are already declared what type it is.  I guess it would still be confused if you used autodeclare for the variables.

    Thanks for the clarification,

    Greg

    Autodeclare: as useful as having a safety switch on a pistol automatically turn itself off when you pick it up.