Moving Desktop Objects

By Andreas Schnellbacher

Files

 * movingdesktopobjects100.zip Version 1.00

Description of the Bug
After system restart all desktop objects moved by the height of the toolbar. For a toolbar at the top of the desktop the objects move upwards. For a toolbar at the bottom they move downwards.

It happens with all toolbars that reduce the workplace area. That means that not only XWorkplace's XCenter (or eCenter) is affected, but also Warp 4's WarpCenter (or SmartCenter).

I can remember that Ulrich Möller wrote that it's an old IBM bug.

How to get rid of it
Unfortunately, the described mechanism is just a workaround and has to be repeated from time to time.

Select one of the required steps:

Run the included CMD file
That step is easy. Just run the included .cmd file RmDesktopFolderPos.cmd and you're done. It removes an erranous entry in OS2.INI for the desktop in icon view. I have tested it for some months now and had no side effects.

The script gets the object handle for . Therefore it looks up in the ini application PM_Workplace:Location. After that, the entry for the icon view of the decimal object handle is removed from PM_Workplace:FolderPos.

Syntax: RmDesktopFolderPos [RUN] [QUIET]

Options (not case-sensitive): RUN   don't ask at startup, only error messages QUIET no output messages, check RC for the result

Move the objects back by using the vertical scroll bar
This step can not be automated. You have to move all objects back. It's not required to grab every object separately:

1.If the vertical scroll bar at the right edge of the desktop is not shown: Move one of the desktop objects upwards (for XCenter at the top) until the vertical scroll bar appears.

2.Then scroll it until it disappears.

3.Maybe repeat the movement of that desktop object and the scrolling until all other objects are on the right place again.

4.After that, move that object back to its correct place.

Appendix
Select one of the following topics:

Copyright and license
This package is freeware and comes with no license. A copyright on the simple REXX script is not intended.

Credits

 * Rich Walsh for explaining the PM_Workplace:FolderPos details.
 * Paul Ratcliffe for the hint that it sometimes suffices to move all (or the right) desktop object a bit.
 * Doug Bisset for pointing to PM_Workplace:FolderPos and mentioning that removing the icon view entry suffices.

Related bug reports in the eCS bugtracker
You have to login on with your eCS account first.


 * http://bugs.ecomstation.nl/view.php?id=2164
 * http://bugs.ecomstation.nl/view.php?id=2143
 * http://bugs.ecomstation.nl/view.php?id=3559
 * http://bugs.ecomstation.nl/view.php?id=2533
 * http://bugs.ecomstation.nl/view.php?id=2330
 * http://bugs.ecomstation.nl/view.php?id=1620
 * http://bugs.ecomstation.nl/view.php?id=491

RmDesktopFolderPos.cmd REXX Script
 /****************************** Module Header ******************************* /* Some header lines are used as help text */ HelpStartLine = 11 HelpEndLine  = 17
 * Module Name: RmDesktopFolderPos.cmd
 * Syntax: RmDesktopFolderPos [RUN] [QUIET]
 * Options (not case-sensitive):
 * RUN   don't ask at startup, only error messages
 * QUIET no output messages, check RC for the result
 * This REXX script deletes the ini key of the desktop's FolderPos in icon
 * view. It helps to work around following OS/2 bug which happens from time
 * to time if a toolbar is configured to reduce the desktop's workarea:
 * After system restart all desktop objects moved by the height of the
 * toolbar. For a toolbar at the top of the desktop the objects move upwards.
 * For a toolbar at the bottom they move downwards.
 * Example for a desktop handle:
 * 0x3BE66 = 24 53 50
 * Example for an ini key in PM_Workplace:FolderPos:
 * 245350@10
 * Andreas Schnellbacher 2014
 * Example for a desktop handle:
 * 0x3BE66 = 24 53 50
 * Example for an ini key in PM_Workplace:FolderPos:
 * 245350@10
 * Andreas Schnellbacher 2014
 * 245350@10
 * Andreas Schnellbacher 2014
 * Andreas Schnellbacher 2014
 * Andreas Schnellbacher 2014
 * Andreas Schnellbacher 2014

/* - Standard REXX initialization follows */ SIGNAL ON HALT NAME Halt

IF ADDRESS <> 'EPM' THEN '@ECHO OFF'

env  = 'OS2ENVIRONMENT' TRUE = (1 = 1) FALSE = (0 = 1) CrLf = '0d0a'x Redirection = '>NUL 2>&1' PARSE SOURCE. . ThisFile GlobalVars = 'env TRUE FALSE Redirection ERROR. ThisFile RC'

/* some OS/2 Error codes */ ERROR.NO_ERROR          =   0 ERROR.INVALID_FUNCTION  =   1 ERROR.FILE_NOT_FOUND    =   2 ERROR.PATH_NOT_FOUND    =   3 ERROR.ACCESS_DENIED     =   5 ERROR.NOT_ENOUGH_MEMORY =   8 ERROR.INVALID_FORMAT    =  11 ERROR.INVALID_DATA      =  13 ERROR.NO_MORE_FILES     =  18 ERROR.WRITE_FAULT       =  29 ERROR.READ_FAULT        =  30 ERROR.SHARING_VIOLATION =  32 ERROR.GEN_FAILURE       =  31 ERROR.INVALID_PARAMETER =  87 ERROR.ENVVAR_NOT_FOUND  = 204

RC = ERROR.NO_ERROR

CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' CALL SysLoadFuncs /* - Standard REXX initialization ends --- */

GlobalVars = GlobalVars 'fQuiet'

/* Get Name of inf file in dir of current file */ InfFileName = 'MovingDesktopObjects.inf' lp = LASTPOS( '\', ThisFile) InfFile = SUBSTR( ThisFile, 1, lp)InfFileName IF (STREAM( InfFile, 'c', 'query exists') = '') THEN InfFile = InfFileName /* Let view search in BOOKSHELF */

/* Get Args */ PARSE ARG Args Args = STRIP( Args)

fQuiet = 0 fAsk  = 1 IF WORDPOS( TRANSLATE( Args), 'RUN') > 0 THEN fAsk = 0 IF WORDPOS( TRANSLATE( Args), 'QUIET') > 0 THEN DO fQuiet = 1 fAsk = 0 END

IF fAsk THEN DO SAY DO l = HelpStartLine TO HelpEndLine CALL SayText( SUBSTR( SOURCELINE( l), 3)) END SAY CALL SayText( 'Type C to continue, H for help or any other key for cancel:') PULL Answer Answer = STRIP( Answer) SELECT WHEN Answer = 'C' THEN NOP WHEN Answer = 'H' THEN DO        /* Show INF file */ 'start view' InfFile EXIT( RC) END OTHERWISE SIGNAL Halt END END

/* Get desktop's object handle */

ObjectId = '' DecObjHandle = GetDecObjHandle( ObjectId) IF RC <> ERROR.NO_ERROR THEN DO CALL SayError( 'Error:' IniKey 'was not found in' IniApp'.') EXIT( RC) END

/* Query desktop's FolderPos entry for icon view */

IniApp  = 'PM_Workplace:FolderPos' ViewId  = 10  /* Icon View */ IniKey  = DecObjHandle'@'ViewId

IniVal = QueryIniKey( IniApp, IniKey) IF RC <> ERROR.NO_ERROR THEN DO CALL SayError( 'Error:' IniKey 'was not found in' IniApp'.') EXIT( RC) END

/* Delete desktop's FolderPos entry for icon view */

CALL DeleteIniKey IniApp, IniKey IF RC <> ERROR.NO_ERROR THEN DO CALL SayError( 'Error:' IniKey 'was not deleted from' IniApp'.') EXIT( RC) END

CALL SayText( IniKey 'for' ObjectId 'was successfully deleted from' IniApp'.') EXIT( ERROR.NO_ERROR)

/* --- */ GetDecObjHandle: PARSE ARG ObjectId

RC = ERROR.NO_ERROR IniApp = 'PM_Workplace:Location' IniKey = ObjectId

DecObjHandle = '' next = QueryIniKey( IniApp, IniKey)

IF RC <> ERROR.NO_ERROR THEN RC = ERROR.READ_FAULT ELSE DO     HexObjHandle = REVERSE( next) DecObjHandle = C2D( HexObjHandle) END

RETURN( DecObjHandle)

/* --- */ QueryIniKey: PROCEDURE EXPOSE (GlobalVars) PARSE ARG IniApp, IniKey

RC = ERROR.NO_ERROR IniVal = '' next = SysIni( 'USER', IniApp, IniKey)

IF next = 'ERROR:' THEN RC = ERROR.READ_FAULT ELSE IniVal = next

RETURN( IniVal)

/* --- */ DeleteIniKey: PROCEDURE EXPOSE (GlobalVars) PARSE ARG IniApp, IniKey

RC = ERROR.NO_ERROR next = SysIni( 'USER', IniApp, IniKey, 'DELETE:')

IF next = 'ERROR:' THEN RC = ERROR.WRITE_FAULT ELSE RC = ERROR.NO_ERROR

RETURN

/* --- */ SayText: PROCEDURE EXPOSE (GlobalVars) PARSE ARG Message IF \fQuiet THEN SAY Message RETURN( '')

/* --- */ SayError: PROCEDURE EXPOSE (GlobalVars) PARSE ARG Message IF \fQuiet THEN SAY Message RETURN( '')

/* --- */ Halt: CALL SayError( 'Interrupted by user.') EXIT( ERROR.GEN_FAILURE)

