Wait Window Alternative

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Red2
Posts: 44
Joined: Sat May 18, 2019 2:11 pm
DBs Used: DBF, FoxPro, Visual FoxPro
Location: United States (East Coast)
Has thanked: 13 times
Been thanked: 2 times

Wait Window Alternative

Post by Red2 » Mon Jul 08, 2019 3:41 pm

Hello All,

Thank you to the HMG community for all of your past help. I have really appreciated it! Now, my project would really benefit from a “Wait Window” like alternative but with more functionality.

Specifically I want to:
1) Display multiple message lines
2) Position this window
3) Have it be the topmost window
4) Close it programitically.

Something like this must already exist or be very doable, no?

I have unsuccessfully tried defining various windows and forms to achieve this. So far I only get syntax errors or am I am unable to programitically close the window. I have also done some HMG Forum searches but have not yet found a solution.

Question: Can someone help me figure out a suitable solution? I would be grateful for any guidance.

Thanks again, Red2

User avatar
karweru
Posts: 185
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Been thanked: 8 times
Contact:

Post by karweru » Mon Jul 08, 2019 4:04 pm

Hi Red2,

I'm not sure whether the following code fragment might be of help...sorry, it's in oop.

Code: Select all


FUNCTION msgWindow(cMsg,cTitle)
STATIC oMsgWin,oMsgLabel

IF empty(oMsgWin)

	oMsgWin:=tWindow():new()
	oMsgWin:windowType("child")
	oMsgWin:row(0)
	oMsgWin:col(0)
	oMsgWin:width(350)
	oMsgWin:height(100)
	oMsgWin:titlebar(.f.)
	oMsgWin:sysMenu(.f.)
	oMsgWin:autoRelease(.f.)
	oMsgWin:sizable(.f.)
	oMsgWin:visible(.f.)
	oMsgWin:onLostFocus({||(oMsgWin:hide())})
	oMsgWin:create()
	
	oMsgLabel:=tLabel():new(oMsgWin)
	oMsgLabel:row(0)
	oMsgLabel:col(0)
	oMsgLabel:width(oMsgWin:width()-5)
	oMsgLabel:height(oMsgWin:height()-10)
	oMsgLabel:border(.t.)
	oMsgLabel:value("Please wait...")
	oMsgLabel:onclick({||.t.})
	oMsgLabel:centeralign(.t.)
	oMsgLabel:backColor({255,255,153})
	oMsgLabel:create()

oMsgWin:center()	
ENDIF

if cMsg!=Nil

	if cTitle!=Nil
	cMsg:=cTitle+newline()+cMsg
	endif
	cMsg:=cMsg+newline()
	oMsgLabel:value(cMsg)
	oMsgWin:show()
	
Return .t.
endif
oMsgLabel:value("")
oMsgWin:hide()
Return .f.
Kind regards,
Gilbert.

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

Post by andyglezl » Mon Jul 08, 2019 5:40 pm

Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
mol
Posts: 3248
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 231 times
Been thanked: 132 times
Contact:

Post by mol » Tue Jul 09, 2019 7:49 am

WaitWindow is normally defined window in your application.
You can change its properties in simple way:

Code: Select all

SetProperty("_HMG_CHILDWAITWINDOW","Height",225)
SetProperty("_HMG_CHILDWAITWINDOW","Message","Height",185)
SetProperty("_HMG_CHILDWAITWINDOW","Message","Row",15)

SetProperty("_HMG_CHILDWAITWINDOW","Message","FontColor", {128,0,0})
SetProperty("_HMG_CHILDWAITWINDOW","Message","FontSize", 16)
You can define your own labels in ChildWindow

User avatar
karweru
Posts: 185
Joined: Fri Aug 01, 2008 1:51 pm
DBs Used: DBF,mysql,mariadb,postgresql,sqlite,odbc
Been thanked: 8 times
Contact:

Post by karweru » Tue Jul 09, 2019 11:22 am

Thank you Mol,

I never knew this... :)
Kind regards,
Gilbert.

Red2
Posts: 44
Joined: Sat May 18, 2019 2:11 pm
DBs Used: DBF, FoxPro, Visual FoxPro
Location: United States (East Coast)
Has thanked: 13 times
Been thanked: 2 times

Post by Red2 » Tue Jul 09, 2019 2:13 pm

Hello mol,

Thank you so much for kindly offering that important information on _HMG_CHILDWAITWINDOW. My being rather new to Harbour/HMG, I had no idea this even existed!

I did another HMG Forum search and found and included one other required (preceeding) command, DECLARE WINDOW _HMG_CHILDWAITWINDOW. Everything works wonderfully!

This simple solution is perfect for this project. I can work fine with a centered window although it would have been a bonus to be able to set its position on the screen.

Also thank you karweru and andyglezl for your very much appreciated suggestions. They should come in handy later on.

Thank you all again!

Red2

User avatar
mustafa
Posts: 849
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Been thanked: 129 times
Contact:

Post by mustafa » Tue Jul 09, 2019 2:25 pm

Hello Mol , very good
following the teacher

Code: Select all


SetProperty("_HMG_CHILDWAITWINDOW","Width ", 450)  
SetProperty("_HMG_CHILDWAITWINDOW","Height", 130)           
SetProperty("_HMG_CHILDWAITWINDOW","Message","Width" ,450)
SetProperty("_HMG_CHILDWAITWINDOW","Message","Height",130 ) 
SetProperty("_HMG_CHILDWAITWINDOW","Message","Row",2)
SetProperty("_HMG_CHILDWAITWINDOW","Message","COL",2)

SetProperty("_HMG_CHILDWAITWINDOW","Message","FontColor", {128,000,000})
SetProperty("_HMG_CHILDWAITWINDOW","Message","BACKCOLOR", {198,245,183}) 

SetProperty("_HMG_CHILDWAITWINDOW","Message","FONTNAME"  ,"Times New Roman")  // <--- "Arial"
SetProperty("_HMG_CHILDWAITWINDOW","Message","FONTSIZE"  , 16 )
SetProperty("_HMG_CHILDWAITWINDOW","Message","FONTBOLD"  ,.T.)
SetProperty("_HMG_CHILDWAITWINDOW","Message","FONTITALIC",.T.)

  wait window   CRLF +'Processing Table - »'  + CRLF+  'stock.db3' nowait 

 inkey(4)
 wait clear
 
Regards
Mustafa

Post Reply