set get() to Buffer

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)


EHcnck - Thu Nov 07 11:47:30 EST 2013

Re: set get() to Buffer
llandale - Thu Nov 07 13:28:01 EST 2013

cmdStr = (string get(commandline))

Re: set get() to Buffer
GregM_dxler - Thu Nov 07 13:59:34 EST 2013

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

Re: set get() to Buffer
EHcnck - Thu Nov 07 14:07:33 EST 2013

llandale - Thu Nov 07 13:28:01 EST 2013

cmdStr = (string get(commandline))

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

Re: set get() to Buffer
llandale - Thu Nov 07 14:57:12 EST 2013

GregM_dxler - Thu Nov 07 13:59:34 EST 2013

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

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

Re: set get() to Buffer
GregM_dxler - Fri Nov 08 09:16:43 EST 2013

llandale - Thu Nov 07 14:57:12 EST 2013

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

Re: set get() to Buffer
llandale - Fri Nov 08 10:20:53 EST 2013

GregM_dxler - Fri Nov 08 09:16:43 EST 2013

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.