Page 1 of 1

Wait Window Alternative

Posted: Mon Jul 08, 2019 3:41 pm
by Red2
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

Re: Wait Window Alternative

Posted: Mon Jul 08, 2019 4:04 pm
by karweru
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.

Re: Wait Window Alternative

Posted: Mon Jul 08, 2019 5:40 pm
by andyglezl

Re: Wait Window Alternative

Posted: Tue Jul 09, 2019 7:49 am
by mol
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

Re: Wait Window Alternative

Posted: Tue Jul 09, 2019 11:22 am
by karweru
Thank you Mol,

I never knew this... :)

Re: Wait Window Alternative

Posted: Tue Jul 09, 2019 2:13 pm
by Red2
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

Re: Wait Window Alternative

Posted: Tue Jul 09, 2019 2:25 pm
by mustafa
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