inputbox

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

t57042
Posts: 148
Joined: Tue Mar 16, 2010 9:46 am
Location: belgium

Inputbox

Post by t57042 »

Why does inputbox not work without MAIN WINDOW??
(Messageinfo and msgyesno do)

Richard
Carlos Britos
Posts: 245
Joined: Sat Aug 02, 2008 5:03 pm

Re: inputbox

Post 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
Regards/Saludos, Carlos (bcd12a)
User avatar
danielmaximiliano
Posts: 2611
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: inputbox

Post 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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Inputbox

Post by Pablo César »

danielmaximiliano wrote:Use Inputbox from WinAPI: http://www.codeproject.com/Articles/242 ... ing-WinAPI
Nice one, Daniel ! :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: inputbox

Post 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
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: inputbox

Post 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

User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: inputbox

Post 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
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Inputbox

Post 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
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Inputbox

Post 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 3277 times
I would HIDE the main form. ;)
Screen2.png
Screen2.png (5.68 KiB) Viewed 3276 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
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: inputbox

Post 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
BPD
Convert Dream into Reality through HMG
Post Reply