Using Setappfocus to workaround the ether
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Using Setappfocus to workaround the ether
Do you do this for this for each individual dialog or for the main application window. What is the general recommendation on when it should be used.
I see the same thing at times and you need to click on the dialog for keystrokes to be responded to.
I see the same thing at times and you need to click on the dialog for keystrokes to be responded to.
Re: Using Setappfocus to workaround the ether
this was in the main application dcread gui
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Using Setappfocus to workaround the ether
I did this in my main application dialog and sporadically I am receiving error reports of "Parameter has wrong data type", Operation: setAppFocus pointing to the xbe__User+34 line. I know I can test for the valtype but was wondering why it is not working. It is possible that the user never processed killDisplayFocus but the user normally has many applications open and switches between the applications.
Any thoughts?
Any thoughts?
Code: Select all
LOCAL oFocus
DCUSEREVENT xbeP_User+33 ACTION {||oFocus := SetAppFocus()}
DCUSEREVENT xbeP_User+34 ACTION {||SetAppFocus(oFocus)}
DCREAD GUI ;
EVAL {|o| oDlg := o, ;
o:killDisplayFocus := {||PostAppEvent( xbeP_User+33,,,oDlg )}, ;
o:setDisplayFocus := {||PostAppEvent( xbeP_User+34,,,oDlg)} }
Re: Using Setappfocus to workaround the ether
Try this:
Code: Select all
LOCAL oFocus // make sure that oFocus is LOCAL.
DCUSEREVENT xbeP_User+33 ACTION {||oFocus := SetAppFocus()}
DCUSEREVENT xbeP_User+34 ACTION {||IIF(Valtype(oFocus)=='O',SetAppFocus(oFocus),nil)}
The eXpress train is coming - and it has more cars.
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Using Setappfocus to workaround the ether
I already had put in the valtype() check.
As for the commend on the LOCAL oFocus, all three portions of the suggested codes are within the same mainmenu() function. So I think oFocus is always in scope.
As for the commend on the LOCAL oFocus, all three portions of the suggested codes are within the same mainmenu() function. So I think oFocus is always in scope.
Re: Using Setappfocus to workaround the ether
I need to know more about the error.
Can you capture the error screen?
Can you capture the error screen?
The eXpress train is coming - and it has more cars.
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Using Setappfocus to workaround the ether
I only have the popup Xbase++ Error message screen and the xbase++ error log. If you need the popup, I can scan it but it does not show the actual program dialog, just the capture of the Xbase++ Error Message popup.
The user was attempting to exit the program at the end of the day. Don't really know what they had all done prior to that. I also received another error log that was the same from another user before I temporarily pulled the program change. Other users may have been in the version with this code. In this case MIKEM was one of the users.
The user was attempting to exit the program at the end of the day. Don't really know what they had all done prior to that. I also received another error log that was the same from another user before I temporarily pulled the program change. Other users may have been in the version with this code. In this case MIKEM was one of the users.
Code: Select all
==============================================================================
ERROR LOG of "C:\fcaprogram\ver6\mainmenu.exe" Date: 01/11/2016 17:19:53
------------------------------------------------------------------------------
Xbase++ version : Xbase++ (R) Version 1.90.355
eXPress++ version : eXPress++ (c) Version 1.9.259
Operating system : Windows 7 06.01 Build 07601 Service Pack 1
Thread ID: 1
User : MJM
Login Name : MIKEM
Company : CXS
Version : (c) 2005-2015 Aqua Finance Inc(6.160111b Build 19.1095)
Database path :
Default Directory :
Current Directory : G:\cxs\data
------------------------------------------------------------------------------
ERROR OBJECT:
------------------------------------------------------------------------------
oError:args :
-> VALTYPE: U VALUE: NIL
oError:canDefault : N
oError:canRetry : N
oError:canSubstitute: Y
oError:cargo : NIL
oError:description : Parameter has a wrong data type
oError:filename :
oError:genCode : 2
oError:operation : setAppFocus
oError:osCode : 0
oError:severity : 2
oError:subCode : 3
oError:subSystem : BASE
oError:thread : 1
oError:tries : 0
DAC last message :
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Called from (B)MAINMENU(348)
Called from DC_GETLIST:EVENTLOOP(4510)
Called from DC_GETLIST:READGUI(3800)
Called from DC_READGUI(111)
Called from MAINMENU(4428)
Called from MAIN(343)
------------------------------------------------------------------------------
WORKAREA STATUS:
------------------------------------------------------------------------------
Area Alias Record Index Order Eof Bof Del Found
------------------------------------------------------------------------------
Re: Using Setappfocus to workaround the ether
It appears, from the log, that you cannot call SetAppFocus() with a NIL.
I don't know where this is being done but according to the error log it appears to be in _DCGETBX.PRG in the below code (line 4510).
It doesn't seem to be related to the new code you put in your app.
Try changing the code to this:
I don't know where this is being done but according to the error log it appears to be in _DCGETBX.PRG in the below code (line 4510).
It doesn't seem to be related to the new code you put in your app.
Code: Select all
IF Valtype(oHelpLink) = 'O' .AND. IsMethod(oHelpLink,'ShowHelpLink')
oAppFocus := SetAppFocus()
oHelpLink:ShowHelpLink()
SetAppFocus(oAppFocus)
Code: Select all
IF Valtype(oHelpLink) = 'O' .AND. IsMethod(oHelpLink,'ShowHelpLink')
oAppFocus := SetAppFocus()
oHelpLink:ShowHelpLink()
IF Valtype(oAppFocus) == 'O'
SetAppFocus(oAppFocus)
ENDIF
The eXpress train is coming - and it has more cars.
-
- Posts: 605
- Joined: Thu Jan 28, 2010 9:11 pm
- Location: Steven Point, Wisconsin USA
- Contact:
Re: Using Setappfocus to workaround the ether
Actually line 4510 in express 259 is, which is the evaluation of the user events. I am not certain that your suggestion is application. The nill is in that setappfocus of the user_event event trigger.
Cliff
Cliff
Code: Select all
IF Valtype(oHelpLink) = 'O' .AND. IsMethod(oHelpLink,'ShowHelpLink')
oAppFocus := SetAppFocus()
oHelpLink:ShowHelpLink()
SetAppFocus(oAppFocus)
ELSEIF Valtype(oHelpLink) = 'B'
nPointer := oXbp:cargo[1]
Eval(oHelpLink,oXbp:cargo[2,nPointer,cGETLIST_HELPCODE])
ELSEIF !Empty(oGetList:helpFile) .AND. Valtype(oGetList:helpFile) = 'C'
::helpObject:showHelpContents()
ENDIF
BREAK
ELSEIF (nPointer := AScan( ::userEvents, {|a|a[1]==nEvent})) > 0
Eval( ::userEvents[nPointer,2], mp1, mp2, oXbp ) // line 4510
ELSEIF nEvent # xbeM_Motion .AND. ;
Re: Using Setappfocus to workaround the ether
I didn't realize you were using build 259.
There is something I don't understand about the way you are using this.
I gave this solution to 2 customers and they are not having any problems with this.
There is something I don't understand about the way you are using this.
I gave this solution to 2 customers and they are not having any problems with this.
The eXpress train is coming - and it has more cars.