Page 1 of 2

Inputbox

Posted: Fri Jun 15, 2012 9:48 am
by t57042
Why does inputbox not work without MAIN WINDOW??
(Messageinfo and msgyesno do)

Richard

Re: inputbox

Posted: Fri Jun 15, 2012 11:27 pm
by Carlos Britos
t57042 wrote:Why does inputbox not work without MAIN WINDOW??
(Messageinfo and msgyesno do)

Richard
Hi
AFAIK is because inputbox is a HMG window, any Hmg window need the Main window, the msg*() are api functions.
Carlos

Re: inputbox

Posted: Fri Jun 15, 2012 11:42 pm
by danielmaximiliano
t57042 wrote:Why does inputbox not work without MAIN WINDOW??
(Messageinfo and msgyesno do)

Richard
Richard :
what is your need for Inputbox before creating the main window?


Use Inputbox from WinAPI : http://www.codeproject.com/Articles/242 ... ing-WinAPI

Inputbox

Posted: Wed Jan 14, 2015 12:48 am
by Pablo César
danielmaximiliano wrote:Use Inputbox from WinAPI: http://www.codeproject.com/Articles/242 ... ing-WinAPI
Nice one, Daniel ! :D

Re: inputbox

Posted: Wed Jan 14, 2015 1:42 am
by Javier Tovar
danielmaximiliano wrote:
t57042 wrote:Why does inputbox not work without MAIN WINDOW??
(Messageinfo and msgyesno do)

Richard
Richard :
what is your need for Inputbox before creating the main window?


Use Inputbox from WinAPI : http://www.codeproject.com/Articles/242 ... ing-WinAPI
+1

Re: inputbox

Posted: Wed Jan 14, 2015 1:55 am
by Javier Tovar
Hi Richard,

You can also simulate InputBox start with, if you do a trick, you do give very small MAIN window after your MsgInfo, big do!

Espro serve you!

regards

Code: Select all

#include "hmg.ch"
Function main()

	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 1 ;         //640,480
		HEIGHT 1 ;
		TITLE 'InputBox Demo' ;
		MAIN ;
		ON INIT (MsgInfo("Hola"),Form_1.WIDTH := 640, Form_1.HEIGHT:=480) 

		@ 50 ,100 BUTTON Button_1 ;
			CAPTION "InputBox Test" ;
			ACTION CLick() ;
	                WIDTH 200 ;
			HEIGHT 30

		@ 100 ,100 BUTTON Button_2 ;
			CAPTION "InputBox (Timeout) Test" ;
			ACTION TCLick() ;
	                WIDTH 200 ;
			HEIGHT 30

		@ 150 ,100 BUTTON Button_3 ;
			CAPTION "InputBox (Timeout) Test 2" ;
			ACTION TCLick2() ;
	                WIDTH 200 ;
			HEIGHT 30

	END WINDOW

	ACTIVATE WINDOW Form_1

Return

Procedure Click

	MsgInfo ( InputBox ( 'Enter text' , 'InputBox Demo' , 'Default Value' )	)

Return

Procedure TClick

	MsgInfo ( InputBox ( 'Enter text' , 'InputBox Demo' , 'Default Value' , 5000 ) )

Return

Procedure TClick2

	MsgInfo ( InputBox ( 'Enter text' , 'InputBox Demo' , 'Default Value' , 5000 , 'Timeout Value' ) )

Return


Re: inputbox

Posted: Wed Jan 14, 2015 2:31 am
by srvet_claudio
See this code:

Code: Select all

Function Main()

   SET WINDOW MAIN OFF
      InputBox()
      _HMG_SYSDATA [ 271 ] := .F.   // _HMG_IsModalActive, InputBox() is a modal Window
   SET WINDOW MAIN ON

   ...
   
Return

Inputbox

Posted: Wed Jan 14, 2015 11:45 am
by Pablo César
Yeah !

I forgot this great detail ! :oops:

Code: Select all

#include <hmg.ch>

Function Main()
Local cTest:=""
SET WINDOW MAIN OFF
    cTest := InputBox ( "Type your name: ", "HMG InputBox Demo without Main Form", cTest )
    _HMG_SYSDATA [ 271 ] := .F.   // _HMG_IsModalActive, InputBox() is a modal Window
SET WINDOW MAIN ON
MsgInfo(cTest)
Return Nil
Very simple and functional !

Thank you Dr. Claudio fo reminding us ! :D

Inputbox

Posted: Wed Jan 14, 2015 11:51 am
by Pablo César
Javier Tovar wrote:You can also simulate InputBox start with, if you do a trick, you do give very small MAIN window
Thank you Javier for your example.

But instead of doing this:
Screen1.png
Screen1.png (1.04 KiB) Viewed 3276 times
I would HIDE the main form. ;)
Screen2.png
Screen2.png (5.68 KiB) Viewed 3275 times
But for sure, SET WINDOW MAIN OFF/ON it's the best option. :D

It's good to have it on mind.

B.Rgds

Re: inputbox

Posted: Wed Jan 14, 2015 12:07 pm
by bpd2000
srvet_claudio wrote:See this code:

Code: Select all

Function Main()

   SET WINDOW MAIN OFF
      InputBox()
      _HMG_SYSDATA [ 271 ] := .F.   // _HMG_IsModalActive, InputBox() is a modal Window
   SET WINDOW MAIN ON

   ...
   
Return
Nice