Getting a simple value without a new window and control

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 119
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 24 times
Been thanked: 5 times

Getting a simple value without a new window and control

Post by bluebird » 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

User avatar
andyglezl
Posts: 858
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 7 times
Been thanked: 25 times
Contact:

Post by andyglezl » Sun Nov 26, 2017 8:49 pm

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: 119
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 24 times
Been thanked: 5 times

Post by bluebird » Mon Nov 27, 2017 1:26 am

No fear, just old fashioned.

edk
Posts: 194
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 55 times
Been thanked: 121 times

Post by edk » Mon Nov 27, 2017 9:28 am

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: 119
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 24 times
Been thanked: 5 times

Post by bluebird » Mon Nov 27, 2017 8:45 pm

Thanks.

Please tell me why you turned the main function off??

edk
Posts: 194
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 55 times
Been thanked: 121 times

Post by edk » Mon Nov 27, 2017 10:53 pm

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