Slow down MSGYESNO()

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Slow down MSGYESNO()

Post by franco »

Is there a way to go into hmg`s msgyesno function to slow down input by using something like
IIF(ISWINDOWACTIVE(WINDOWMSGYESNO),CONTINUE,NIL)
I created my own yesnobox with public variabel YN which works well. On my yes and no buttons I use
button Y Action IIF(ISWINDOWACTIVE(WINDOWMYYESNO),(YN := .T. , myyesno.release),NIL)
button N Action IIF(ISWINDOWACTIVE(WINDOWMYYESNO),(YN := .F. , myyesno.release),NIL)
Nothing happens until the window is active
It would be more convenient to just use use msgyesno.
The reason is I have a grid with a ON KEY F3 IF MSGYESNO .. DELETE and if a person wants delete a lot of grid items they get going very fast and
crash the progam. With my box YN does happen until window is active so it just loops.
Any thoughts ........ Franco ;)
All The Best,
Franco
Canada
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Slow down MSGYESNO()

Post by edk »

I do not really understand why there is a problem, because MsgYesNo opens a Modal window, so other events (unless the exception is a timer) should not be handled until you close MsgYesNo. Theoretically you can not be called repeatedly ON KEY F3 event until it is serviced MsgYesNo the previous call event.

But maybe try something like this:

Code: Select all


ON KEY F3 ACTION SomeFunc()

*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*
FUNCTION SomeFunc()
STATIC ISinProgress := .F.
IF ISinProgress
	RETURN Nil
ENIDF
ISinProgress := .T.

IF MsgYesNo 
	
ELSE
	
ENDIF

ISInProgress := .F.
RETURN Nil
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Slow down MSGYESNO()

Post by franco »

Originally when Serge had this problem, it was the forums thought the yesno window was trying to release before it was active.
The error is ..... window not active.
myyesno works fine but I thought there must be something in the hmg msgyesno could be changed. I am going to keep using myyesno as it does
not crash program.
I have public variable 'YN' := .F.
TIT parameter := label message

Code: Select all

		DEFINE WINDOW Myyesno ;
		AT  getDeskTopHeight()/2-70 ,getdesktopWidth() /2-175 ;
		WIDTH 350 ;
		HEIGHT 140 ;   //TITLE TIT ;
		MODAL ;
		SIZABLE .F. ; //
		BACKCOLOR {0,128,192 } ;
		SYSMENU .F. ;
		TITLEBAR .F. 
		
		DEFINE LABEL LAB1
       	        ROW 10
                COL 10
                WIDTH 330
                 HEIGHT 80
		 BACKCOLOR {255,255,255}
		 VALUE ''
		END LABEL
		
		DEFINE LABEL LAB11
                ROW 35
               COL 10
               WIDTH 330
               HEIGHT 20
		 FONTNAME 'ARIAL'
		 FONTSIZE 11
		 FONTBOLD .F.
		 ALIGNMENT CENTER
		 BACKCOLOR {255,255,255}
		 VALUE LABV              //'Enter Text    (Escape/Blank to Exit)'
		END LABEL

		DEFINE BUTTON BUT1
                ROW 100
               COL 40
               WIDTH 100
              HEIGHT 30
		 CAPTION '&Yes'	
		 ACTION  IIF(ISWINDOWACTIVE(MYYESNO),{YN := .T.  , MyYESNO.Release} ,NIL)
		END BUTTON
		
		DEFINE BUTTON BUT2
                ROW 100
                COL 210
                WIDTH 100
                HEIGHT 30
		 CAPTION '&No'
		 ACTION IIF(ISWINDOWACTIVE(MYYESNO),{YN := .F.  , MyYESNO.Release} ,NIL)
		END BUTTON
	 
		ON KEY F1 ACTION Helping('CRSWin.hlp')
		ON KEY ESCAPE OF Myyesno Action IIF(ISWINDOWACTIVE(MYYESNO),{YN := .F.  , MyYESNO.Release} ,NIL )
		
		END WINDOW
		MYYESNO.BUT1.SetFocus
		Myyesno.Activate
	
	Return YN
Thanks .. Franco ;)
All The Best,
Franco
Canada
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Slow down MSGYESNO()

Post by andyglezl »

Hola Franco

Segun lo entiendo, yo lo haría de esta forma.

En el grid, poner otro campo en donde marquen cuales lineas se borrarán,
ya marcadas, oprimir un botón que que diga "Borrar lo marcado" y poner un mensaje
de que esperen a que termine el proceso.
--------------------------------------------------------------------------------------------------------------
Hello Franco

As I understand it, I would do it this way.

In the grid, put another field where they mark which lines will be deleted,
already checked, press a button that says "Delete what is marked" and put a message
that they wait for the process to end.
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: Slow down MSGYESNO()

Post by apais »

oninit CLEAR TYPEAHEAD ?
Angel Pais
Web Apps consultant/architect/developer.
HW_apache (webserver modules) co-developer.
HbTron (Html GUI for harbour desktop hybrid apps) co-developer.
https://www.hbtron.com
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Slow down MSGYESNO()

Post by franco »

Remember myyesno above works fine.
How could we put clear typeahead in hmg`s msgyesno.
This is the problem. If someone hits Y before window is active The error appears.
I can shut down on F3 until the grid updates after F3, but this can be a potential problem in all msgyesno commands.
My myyesno works fine. Hmg`s msgyesno needs Apais idea.
Thanks for thoughts.
All The Best,
Franco
Canada
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Slow down MSGYESNO()

Post by andyglezl »

Cada cabeza es un mundo...
--------------------------------------
Each head is a world...
Andrés González López
Desde Guadalajara, Jalisco. México.
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Slow down MSGYESNO()

Post by franco »

Help again, how can I set default to no in msgyesno. I have spent an hour searching forum.
Franco
All The Best,
Franco
Canada
edk
Posts: 909
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Slow down MSGYESNO()

Post by edk »

MsgYesNo ( <xData> , [<cTitle>] , [<lRevertDefault>] ) --> lResponse

MsgYesNo ( <xData> , [<cTitle>] ) or MsgYesNo ( <xData> , [<cTitle>], .F. ) default "Yes" button
MsgYesNo ( <xData> , [<cTitle>] , .T. ) default "No" button
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Slow down MSGYESNO()

Post by franco »

Thanks for response. I was using this but never thought .T. would be NO. I kept trying .F.
Franco ;)
All The Best,
Franco
Canada
Post Reply