Silverfrost Forums

Welcome to our forums

Size of status line

21 Aug 2010 5:30 #6810

Just a small question:

I use %ob[status,thin_panelled] and for some applications I need the height of that box in pixels. This value depends on the settings of the OS and (may be) on some other parameters. Is there a simple way to get what I need from within my programme?

Thanks in advance, Wilfried

21 Aug 2010 5:35 #6811

If there is a control within the %ob area then you will be able to get its Windows handle and then its size from the handle.

I don't think that there is a control associated with %ob itself.

Let me have a small sample and I can check this out for you.

21 Aug 2010 10:52 #6813

Paul, I use the status line only within the main window of a programme. My code is always more or less like here:

  WINAPP
  OPTIONS(INTL)

  PROGRAM UTIL

  IMPLICIT NONE
  INCLUDE <WINDOWS.INS>

  external      <cb_functions>

  integer*4     j
  character*120 statlin

  common  /status/  statlin

  statlin = 'c:\\lisa_g\'

  j = winio@('%ca[Utilities]%bg[grey]%ww[no_border]%sz%sp&amp;',
 *           600,400,200,100)
  j = winio@('%mn[&amp;File[option_1,option_2,|,&amp;End]]&amp;',
 *           'continue','continue','EXIT')
  j = winio@('%1.1ob[status,thin_panelled]%40st%cb',statlin)

  end

Thanks and best regards, Wilfried

22 Aug 2010 8:32 #6814

Wilfried,

Have you tried measuring it under different OS settings? I have often found that the height of various Windows features is remarkably constant. I have used an on-screen pixel ruler called 'Ruler by George' to do these measurements (Google search for it. The demo version is free). Another way is to do a screen grab with Shift-PrtSc, paste it into Paint. Then cut the area you are interested in, paste it to a new 'document' in Paint (this makes it manageable) and zoom. Then you can count the pixels.

Some things in Windows are scaled in terms of average character cell width and height, but some are scaled in pixels - such as borders. Your status line may be one such.

Eddie

23 Aug 2010 6:32 #6815

Here are some thoughts...

If you run the Spy tool from the Plato Tools menu then you will see that %st has its own Windows handle for the 'Static' text. So you might find it useful to get the size of this control. However, this may just depend on the size of the font and it is not the same as the surrounding box for %ob. I think that this is just drawn by ClearWin+ on the fly.

If the relevant font size or the size of the 'Static' control does not help then I guess the only way forward would be for me to dig this information out of ClearWin+ and give you a clearwin_info@ value to get hold of it.

23 Aug 2010 7:37 #6816

Thank you for your remarks!

I tried a lot this weekend and meanwhile I found some solutions. First of all I start my main window (including the status bar) with %ww[maximise], this works perfectly meaning that the task bar is visible but nothing more. Within this main window I put a graphics area for which I have to define the size in pixels, so I need the size of the task bar and the status bar. The size of the task bar I calculate using GetSystemMetrics(SM_CXSCREEN) – GetSystemMetrics(SM_CXFULLSCREEN) for x and analogue for y. This works for any position of the task bar (left, bottom, …) and for any size of it. Because the dimensions of my graphics area are not critical I set the height of the status bar to 50 pixels, this seems to be OK for all Windows settings. I always use a defined font size and only one line of text within the status bar. Nevertheless I will follow your ideas to make things a bit clearer for me.

Regards, Wilfried

Please login to reply.