Page 1 of 1

TEXTBOX to Variable

Posted: Mon Jul 19, 2010 7:40 pm
by melliott42
Hello All,

For some strange reason I cannot set the value of a TEXTBOX to a variable. I can output the value to a MsgBox().

Works:

Code: Select all

msgbox(oWin.txtConn_Driver.value)
Does not compile:

Code: Select all

function test()
      local x
      x := oWin.txtConn_Driver.value
return nil
Error:

Code: Select all

 ...Error E0030  Syntax error "syntax error at '.'"
What can you recommend?

Thanks,

Michael

Re: TEXTBOX to Variable

Posted: Mon Jul 19, 2010 8:00 pm
by esgici
melliott42 wrote: ...
What can you recommend?
I recommend please send no abstracted statements but a working sample abstracted from other details ;)

Regards

--

Esgici

Re: TEXTBOX to Variable

Posted: Mon Jul 19, 2010 8:00 pm
by mol
Is your oWin declared in the same module as test function?

Re: TEXTBOX to Variable

Posted: Mon Jul 19, 2010 8:02 pm
by esgici
Hi Marek

Welcome back :)

You are absent for a long time :(

Regards

--

Esgici

Re: TEXTBOX to Variable

Posted: Tue Jul 20, 2010 4:13 am
by dhaine_adp
For some strange reason I cannot set the value of a TEXTBOX to a variable. I can output the value to a MsgBox().
Hi Michael,

You've never mention if the source codes are in separate .prg source. If you are using HBClass or HMG Objects or you have created a window inside of a Class for sure that would give an error message.

Why not call test with the value of text box control?

Code: Select all

test(oWin.txtConn_Driver.value)

function test( cTxt )

  do your processing here!

return nil
My suggestion is based on assumption only.


Regards,

Danny

Re: TEXTBOX to Variable

Posted: Tue Jul 20, 2010 7:48 am
by mol
esgici wrote:Hi Marek

Welcome back :)

You are absent for a long time :(

Regards

--

Esgici
Yes, I was on holidays (again :)).
Now, I'm slowly backing to work.

Re: TEXTBOX to Variable

Posted: Tue Jul 20, 2010 7:49 am
by mol
dhaine_adp wrote:
For some strange reason I cannot set the value of a TEXTBOX to a variable. I can output the value to a MsgBox().
Hi Michael,

You've never mention if the source codes are in separate .prg source. If you are using HBClass or HMG Objects or you have created a window inside of a Class for sure that would give an error message.

Why not call test with the value of text box control?

Code: Select all

test(oWin.txtConn_Driver.value)

function test( cTxt )

  do your processing here!

return nil
My suggestion is based on assumption only.


Regards,

Danny
You can change your code to:

Code: Select all


ctxt := GetProperty("oWin","txtConn_Driver","value")
test(ctxt)

Re: TEXTBOX to Variable

Posted: Tue Jul 20, 2010 12:09 pm
by melliott42
Thanks for all your suggestions. Yes the code that attempts to extract the value was in an external #INCLUDE file. I am trying to separate my GUI code from my other program logic.

I am not using CLASSES but I can see how I was misleading given that I did not post it in full (as I named my Window handle oWin). I think I'll change my naming convention there.

GetProperty("oWin","txtConn_Driver","value") did the trick! :-)

Thanks again,


Michael

Re: TEXTBOX to Variable

Posted: Tue Jul 20, 2010 12:31 pm
by dhaine_adp
Hi Marek,
ctxt := GetProperty("oWin","txtConn_Driver","value")
test(ctxt)
Great Marek, thanks.

Danny

Re: TEXTBOX to Variable

Posted: Tue Jul 20, 2010 12:57 pm
by mol
I was looking for that some years ago :D