Slow down MSGYESNO()

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
franco
Posts: 237
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 8 times

Slow down MSGYESNO()

Post by franco » Sat Mar 31, 2018 6:28 pm

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 ;)

edk
Posts: 284
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 76 times
Been thanked: 225 times

Post by edk » Sat Mar 31, 2018 7:28 pm

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: 237
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 8 times

Post by franco » Sun Apr 01, 2018 4:56 pm

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 ;)

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

Post by andyglezl » Sun Apr 01, 2018 11:55 pm

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: 268
Joined: Fri Aug 01, 2008 6:03 pm
Location: uruguay
Has thanked: 31 times
Been thanked: 21 times
Contact:

Post by apais » Mon Apr 02, 2018 1:11 am

oninit CLEAR TYPEAHEAD ?

franco
Posts: 237
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 8 times

Post by franco » Mon Apr 02, 2018 2:37 am

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.

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

Post by andyglezl » Mon Apr 02, 2018 4:47 am

Cada cabeza es un mundo...
--------------------------------------
Each head is a world...
Andrés González López
Desde Guadalajara, Jalisco. México.

franco
Posts: 237
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 8 times

Post by franco » Wed Apr 04, 2018 7:09 pm

Help again, how can I set default to no in msgyesno. I have spent an hour searching forum.
Franco

edk
Posts: 284
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 76 times
Been thanked: 225 times

Post by edk » Wed Apr 04, 2018 7:18 pm

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: 237
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 8 times

Post by franco » Wed Apr 04, 2018 8:45 pm

Thanks for response. I was using this but never thought .T. would be NO. I kept trying .F.
Franco ;)

Post Reply