inputbox

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

t57042
Posts: 148
Joined: Tue Mar 16, 2010 9:46 am
Location: belgium
Has thanked: 2 times
Been thanked: 4 times

Inputbox

Post by t57042 » Fri Jun 15, 2012 9:48 am

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

Richard

Carlos Britos
Posts: 220
Joined: Sat Aug 02, 2008 5:03 pm
Has thanked: 6 times
Been thanked: 2 times

Post by Carlos Britos » Fri Jun 15, 2012 11:27 pm

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: 2137
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 154 times
Been thanked: 23 times
Contact:

Post by danielmaximiliano » Fri Jun 15, 2012 11:42 pm

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
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`.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
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Wed Jan 14, 2015 12:48 am

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
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Wed Jan 14, 2015 1:42 am

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
Has thanked: 1 time
Been thanked: 2 times

Post by Javier Tovar » Wed Jan 14, 2015 1:55 am

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: 2044
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Has thanked: 35 times
Been thanked: 146 times
Contact:

Post by srvet_claudio » Wed Jan 14, 2015 2:31 am

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
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Wed Jan 14, 2015 11:45 am

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
Has thanked: 100 times
Been thanked: 182 times

Post by Pablo César » Wed Jan 14, 2015 11:51 am

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 1591 times
I would HIDE the main form. ;)
Screen2.png
Screen2.png (5.68 KiB) Viewed 1590 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: 1077
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 197 times
Been thanked: 96 times

Post by bpd2000 » Wed Jan 14, 2015 12:07 pm

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