TEXTBOX to Variable

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

TEXTBOX to Variable

Post 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
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: TEXTBOX to Variable

Post 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
Viva INTERNATIONAL HMG :D
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: TEXTBOX to Variable

Post by mol »

Is your oWin declared in the same module as test function?
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: TEXTBOX to Variable

Post by esgici »

Hi Marek

Welcome back :)

You are absent for a long time :(

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: TEXTBOX to Variable

Post 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
Regards,

Danny
Manila, Philippines
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: TEXTBOX to Variable

Post 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.
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: TEXTBOX to Variable

Post 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)
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: TEXTBOX to Variable

Post 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
User avatar
dhaine_adp
Posts: 457
Joined: Wed Aug 06, 2008 12:22 pm
Location: Manila, Philippines

Re: TEXTBOX to Variable

Post by dhaine_adp »

Hi Marek,
ctxt := GetProperty("oWin","txtConn_Driver","value")
test(ctxt)
Great Marek, thanks.

Danny
Regards,

Danny
Manila, Philippines
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: TEXTBOX to Variable

Post by mol »

I was looking for that some years ago :D
Post Reply