Page 1 of 1

Slow down MSGYESNO()

Posted: Sat Mar 31, 2018 6:28 pm
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 ;)

Re: Slow down MSGYESNO()

Posted: Sat Mar 31, 2018 7:28 pm
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

Re: Slow down MSGYESNO()

Posted: Sun Apr 01, 2018 4:56 pm
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 ;)

Re: Slow down MSGYESNO()

Posted: Sun Apr 01, 2018 11:55 pm
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.

Re: Slow down MSGYESNO()

Posted: Mon Apr 02, 2018 1:11 am
by apais
oninit CLEAR TYPEAHEAD ?

Re: Slow down MSGYESNO()

Posted: Mon Apr 02, 2018 2:37 am
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.

Re: Slow down MSGYESNO()

Posted: Mon Apr 02, 2018 4:47 am
by andyglezl
Cada cabeza es un mundo...
--------------------------------------
Each head is a world...

Re: Slow down MSGYESNO()

Posted: Wed Apr 04, 2018 7:09 pm
by franco
Help again, how can I set default to no in msgyesno. I have spent an hour searching forum.
Franco

Re: Slow down MSGYESNO()

Posted: Wed Apr 04, 2018 7:18 pm
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

Re: Slow down MSGYESNO()

Posted: Wed Apr 04, 2018 8:45 pm
by franco
Thanks for response. I was using this but never thought .T. would be NO. I kept trying .F.
Franco ;)