Paradox Community
Search:

 Welcome |  What is Paradox |  Paradox Folk |  Paradox Solutions |
 Interactive Paradox |  Paradox Programming |  Internet/Intranet Development |
 Support Options |  Classified Ads |  Wish List |  Submissions 


Paradox Programming Articles  |  Beyond Help Articles  |  Tips & Tricks Articles  


Hiding the Status Bar in ObjectPAL
© 2002 Paul Cronk

Introduction

The status bar in Paradox can be reduced to one line, but cannot be hidden completely. Some applications prefer not to have the status bar, however, Paradox provides no internal support for hiding or showing the status bar completely. The following codes gives the ability to do so, using some well known Windows API calls.

This code will work in 32bit versions of Paradox, regardless of the version of Paradox. The code checks the major version of the Paradox, and determines the classname from it.

Anyway, onto the code :-)

In the uses section of your form add the following:
Uses "user32"
  FindWindowExA (lWnd CLONG, lSubWnd CLONG, pszClassName CPTR, pszWindowName CPTR) CLONG [stdcall]
  GetWindow (lWnd CLONG, lCmd CLONG) CLONG [stdcall]
  ShowWindow (lWnd CLONG, lFlags CLONG) [stdcall]
endUses
In the var section of your form, add the following
Var
  strClassName   String
endVar
Create a method called showStatusBar in your form or library with the code below:
method showStatusBar(const loShowStatusBar Logical) Logical
var
  lWnd             LongInt
  lDesktopWnd      LongInt
  lChildWnd        LongInt
  lFoundWnd        LongInt
  appDesktop       Application
  tcWindows        TCursor
  strVersion       String
endvar

;// check to see if we have already assigned the classname 
if NOT strClassName.isAssigned() then
  strVersion = substr (version(), 1, 1)

  ;// if this is version 7 or 8, then the classname is as follows.
  if ((strVersion = "7") or (strVersion = "8")) then
    strClassName = "msctls_statusbar32"

  ;// other versions require use to look it up.  It starts with Afx...
  else
    enumDesktopWindowNames (":priv:__classnames.db")

    tcWindows.open (":priv:__classnames.db")
    if not (tcWindows.locatePattern ( "ClassName", "Afx:..")) then
      tcWindows.close()
      return FALSE
    endif

    strClassName = tcWindows."ClassName"
    tcWindows.close()
  endif
endif

;// now that we have the correct classname, proceed...
lDesktopWnd = appDesktop.windowHandle()

;// find the first toolbar window
lFoundWnd = FindWindowExA (lDesktopWnd, 0, strClassName, "")
while (lFoundWnd <> 0)

  ;// if this toolbar has a child, then its the status bar.
  lChildWnd = GetWindow (lFoundWnd, 5)
  if (lChildWnd <> 0) then
    if (loShowStatusBar = True) then
      ShowWindow (lFoundWnd, 5);  ;// show the status bar
    else
      ShowWindow (lFoundWnd, 0);  ;// otherwise hide..
    endif
    return TRUE
  endif

  ;// find the next toolbar window
  lFoundWnd = FindWindowExA (lDesktopWnd, lFoundWnd, strClassName, "")

endwhile

return FALSE
endMethod
You can hide the status bar by calling it with :
 showStatusBar (False);
or show it again by calling :
 showStatusBar (True);
... and checking the return code as necessary.

Conclusion

There are no side effects to calling the function to show the status bar if it is already visible, or hide it when invisible.

Feel free to modify and redistribute the code as necessary.


Discussion of this article


 Feedback |  Paradox Day |  Who Uses Paradox |  I Use Paradox |  Downloads 


 The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation.
 Paradox is a registered trademark of Corel Corporation.


 Modified: 15 May 2003
 Terms of Use / Legal Disclaimer


 Copyright © 2001- 2003 Paradox Community. All rights reserved. 
 Company and product names are trademarks or registered trademarks of their respective companies. 
 Authors hold the copyrights to their own works. Please contact the author of any article for details.