Topics

How to reset Screen State automatically #ria #xpa

Darren
 

Hello Everyone,

As of now we all know that most of our users are working from home.
And there is 1 issue that keeps occurring. That is the window tends to be missing and nowhere to be found but the application is already opened in the taskbar and in the task manager also. This is because our users used to have a second display at the office and at home they only have 1 display.

I resolve this by asking the user to close the application and delete the files on this folder:  %userprofile%\AppData\Roaming\MSE
I tried making a function insde XPA but it just keeps creating them because the application is still open.


Is there any way to do this automatically? Or is there any other way to reset the Screen State?

Best Regards,
Darren

Tim Downie
 

Function called formstateclear i think....run this when app initialises on client side - it will all reset
From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Darren <darren.jimenez@...>
Sent: Friday, 22 May 2020 1:42 AM
To: main@magicu-l.groups.io <main@magicu-l.groups.io>
Subject: [magicu-l] How to reset Screen State automatically #xpa #ria
 

Hello Everyone,

As of now we all know that most of our users are working from home.
And there is 1 issue that keeps occurring. That is the window tends to be missing and nowhere to be found but the application is already opened in the taskbar and in the task manager also. This is because our users used to have a second display at the office and at home they only have 1 display.

I resolve this by asking the user to close the application and delete the files on this folder:  %userprofile%\AppData\Roaming\MSE
I tried making a function insde XPA but it just keeps creating them because the application is still open.


Is there any way to do this automatically? Or is there any other way to reset the Screen State?

Best Regards,
Darren

Wes Hein
 

I put a global event in the main program <Ctrl-F8> that issues a FormStateClear('') to just clear the form they are parked on.  In the menu I added a Clear All Form States option that calls a batch with a FormStateClear('*'),  Alternately you could all a separate global event to clear all states as well.  Nothing 'magic' about the key combination I selected, was just what I picked at the time.

Wes

Steven Blank
 

Darren,

One way to address this issue would be to specify a fixed initial position and size for the MDI.

To force the MDI to always open with the top-left corner at the (x,y) screen coordinates (0,0), and with an initial size of 640 by 480 pixels, that is, with the bottom-right corner at (640,480), add the following to the MAGIC.INI file's [MAGIC_ENV] section:

[MAGIC_ENV]
MDIleft = 0
MDItop = 0
MDIright = 640
MDIbottom = 480

With these settings added to the MAGIC.INI file, the application will always startup in the same position and at the same size. BTW, these settings only affect the MDI – all other child screens' positions and sizes will be persisted as before, and the user, of course, is free to move, resize, max, and min the MDI as they desire.

HTH.

Steve Blank

P.S. There are more such settings that you might want to play with, some documented, some not. The complete library (AFAIK) of such settings are as follows:

MDIClientEdge = Y|N
MDIClientImageFile =
MDIClientImageStyle =
MDIleft = 88
MDItop = 109
MDIright = 379
MDIbottom = 394
;MDIMinX = -1
;MDIMinY = -1
;MDIShow = 1
;MDIFlags = 0
;xScreen = 726
;yScreen = 80


On 5/21/2020 6:42 PM, Darren wrote:

Hello Everyone,

As of now we all know that most of our users are working from home.
And there is 1 issue that keeps occurring. That is the window tends to be missing and nowhere to be found but the application is already opened in the taskbar and in the task manager also. This is because our users used to have a second display at the office and at home they only have 1 display.

I resolve this by asking the user to close the application and delete the files on this folder:  %userprofile%\AppData\Roaming\MSE
I tried making a function insde XPA but it just keeps creating them because the application is still open.


Is there any way to do this automatically? Or is there any other way to reset the Screen State?

Best Regards,
Darren

Steven Blank
 

Wes,

I'm likely wrong, but I don't believe that FormStateClear('*') will produce the OP's desired result, at least I have not been successful in achieving his goal just now, in my admittedly-limited testing.

Specifically, FormStateClear() is a Magic function and, as such, can only be evaluated while the MDI is open. As a result, one may indeed clear the current state of all open windows, but the final position and size of the MDI will always be saved again afterward, even after the Main Program's Task Suffix is executed, when the user exits the application.

Moreover, child windows' positions, sizes, etc. are saved in the Application Data folder, while the position and size of the MDI is saved in the registry, as a matter of standard OS functionality.

Steve Blank

Wes Hein
 

Steve,

I guess I've never had the main screen appear off screen so I can't say about that, but have had modal windows decide to do so and the FormStateClear makes them visible again and remembers the proper location without requiring an exit/restart.

Wes

Darren
 

Hello All,

Thanks for your help. It seems the  FormStateClear('*') works for me. I will play more with this and see how far I can get.

Best Regards,

Darren