Page 1 of 1
Getting a simple value without a new window and control
Posted: Sun Nov 26, 2017 7:54 pm
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
Re: Getting a simple value without a new window and control
Posted: Sun Nov 26, 2017 8:49 pm
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 '.
Re: Getting a simple value without a new window and control
Posted: Mon Nov 27, 2017 1:26 am
by bluebird
No fear, just old fashioned.
Re: Getting a simple value without a new window and control
Posted: Mon Nov 27, 2017 9:28 am
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.
Re: Getting a simple value without a new window and control
Posted: Mon Nov 27, 2017 8:45 pm
by bluebird
Thanks.
Please tell me why you turned the main function off??
Re: Getting a simple value without a new window and control
Posted: Mon Nov 27, 2017 10:53 pm
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.