Getting a simple value without a new window and control

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Getting a simple value without a new window and control

Post by bluebird »

Please educate me here friends

Because I want a simple value to be input, I tried this Inputbox, but it will not work as wanted

nOutColorMode:=Val(MsgInfo ( InputBox ( 'Enter Color' , '' " , '33' ) ))

The MsgInfo control returns a NIL, ignoring the value input - ex "33". Val("33") is the wanted result.

Is there another HMG function that would let me input a value and have it returned so that I can assign it
to a variable like nOutColorMode above without creating a new window with a new textbox control.

Like the old clipper at say get idea

Thank you
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Getting a simple value without a new window and control

Post by andyglezl »

Hola Bluebird, no me queda claro tu "temor" a crear nuevas ventanas,
que de hecho ya estas creando 2 nuevas ventanas con el InputBox() y
el MsgInfo().

El msgInfo() no te regresa nada, el InputBox() sería el que te regresa '33' .
*----------------------------------------------------------------------------------------------
Hello Bluebird, it is not clear your "fear" to create new windows,
Which in fact you are already creating 2 new windows with the InputBox () and
The MsgInfo ().
The MsgInfo () does not return anything, the InputBox () would be the one that returns you ' 33 '.
Andrés González López
Desde Guadalajara, Jalisco. México.
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Getting a simple value without a new window and control

Post by bluebird »

No fear, just old fashioned.
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Getting a simple value without a new window and control

Post by edk »

bluebird wrote: Sun Nov 26, 2017 7:54 pm Please educate me here friends

Because I want a simple value to be input, I tried this Inputbox, but it will not work as wanted

nOutColorMode:=Val(MsgInfo ( InputBox ( 'Enter Color' , '' " , '33' ) ))

The MsgInfo control returns a NIL, ignoring the value input - ex "33". Val("33") is the wanted result.

Is there another HMG function that would let me input a value and have it returned so that I can assign it
to a variable like nOutColorMode above without creating a new window with a new textbox control.

Like the old clipper at say get idea

Thank you
Hi. The MsgInfo function (it is not a control :!: ) will always returns a NIL value (see: http://www.hmgforum.com/hmgdoc/data/msginfo.htm), if you want to get value of InputBox, you should do this in that way:

Code: Select all

#include <hmg.ch>

Function Main

SET WINDOW MAIN OFF

nOutColorMode:=VAL( InputBox ( 'Enter Color' , '' , '33' ))
MsgInfo(nOutColorMode)

SET WINDOW MAIN ON

RETURN NIL
You may also be interested with the "InputWindow()" function.
bluebird
Posts: 172
Joined: Wed Sep 28, 2016 3:55 am
DBs Used: DBF

Re: Getting a simple value without a new window and control

Post by bluebird »

Thanks.

Please tell me why you turned the main function off??
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Getting a simple value without a new window and control

Post by edk »

Normally, InputBox is based on a MODAL window that requires a defined parent (Main) window.
With the SET WINDOW MAIN OFF command, I skip the need to define a MAIN window to properly operate the MODAL window, just in case.
Post Reply