View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Thu Apr 25, 2019 2:34 pm Post subject: Status bar %sb |
|
|
The help file states somewhat confusingly:
Quote: | Modifiers
Tilde (~) - indicates that the first panel of the status bar is to be used for help strings.
Description
N is optional. When N > 1, it specifies the number of panels and iar is an integer array specifying the width (in average characters) of each panel in turn. The width of the last panel is set automatically to extend to the right hand edge of the window. When N is not provided, iar is also omitted, resulting in just one panel. A grave accent can be applied and indicates that the first panel of the status bar is to be used for help strings. |
Not that it matters, because the truth can be established by some simple trials.
My question is: Is there a way of determining at runtime how many characters are (roughly) available in a status bar ?
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Thu Apr 25, 2019 3:13 pm Post subject: |
|
|
Eddie
I have corrected the help file but this is probably not in time for the next release.
ClearWin+ does not currently provide a simple way to get the current size of a given panel in the status bar.
The information is available via a call to SendMessage by using the HWND of the status bar and SB_GETRECT. If you want to try this then the first step would be to test to see if %lc works for %sb. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Thu Apr 25, 2019 4:16 pm Post subject: |
|
|
Paul,
Thanks. SET_STATUS_TEXT@ doesn't appear to be in the Library Reference either.
When is the next version due?
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Thu Apr 25, 2019 6:28 pm Post subject: |
|
|
We are working on it right now. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Fri Apr 26, 2019 6:44 am Post subject: |
|
|
Quote: | I assume that there's a check built into %sb which flags an error... |
No check is carried out. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Fri Apr 26, 2019 2:49 pm Post subject: |
|
|
Paul,
I followed up the suggestion, and it isn't a lot of help. I came across SBARS_SIZEGRIP - that is something that puts the sizing icon in the bottom rhs of the window. Aesthetically, when the client area extends to the bottom of the window, the window looks a bit unbalanced, and even when a status bar is in use, (because everything is clustered to the left), the 'size-grip' is a nice feature, even if it is rather obsolete as all window edges are resizable these days.
I also saw that the status bar can have tooltips. My suggestion is therefore for:
%sb[sizegrip][tooltips]
I'm not much of a fan of straying outside Clearwin+, as you probably guessed.
I probably didn't express myself well in the original post. What I really want to do is find out how much capacity the status bar has before I invoke winio@('%sb so that I don't simply program invisible stuff off the end. I know this will be wrong for different logical dpi settings, so it will need to be assessed conservatively. Perhaps it's a question of running some tests and measuring using my onscreen pixel ruler: 'RulerByGeorge!'
Eddie
PS. Just about everything I write is run fullscreen, because the maximum number of pixels is required for the best graphical interaction. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Fri Apr 26, 2019 4:52 pm Post subject: |
|
|
Eddie
I have made a note of your request/suggestion. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Sun Apr 28, 2019 2:19 pm Post subject: |
|
|
Paul,
Many thanks for considering this.
Eddie |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Mon Apr 29, 2019 1:26 pm Post subject: |
|
|
I've done some measurements, and with a standard dpi setting, the text typically has a length that equates to about 5.3 pixels per character.
I run a dual monitor setup, with two 1920x1080 screens side by side. When my app with a %sb is launched, the statusbar doesn't have a 'sizegrip' If I move the window to straddle the two monitors, the window extends laterally, and the status bar then shows a 'sizegrip', which then remains part of it even if the window is shrunk back to fit on one screen. Weird.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Wed May 01, 2019 1:24 pm Post subject: |
|
|
Eddie
I have had a look at this.
SBARS_SIZEGRIP does not appear to do anything useful. If the window can be resize then you get the gripper anyway. If the window can't be resized then SBARS_SIZEGRIP adds the gripper but you can't use it to resize the window.
I will see if anything can be done with tooltips. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Wed May 01, 2019 5:08 pm Post subject: |
|
|
Eddie
The SBARS_TOOLTIPS style is rather limited. Its purpose is to provide a tooltip for when the text is too long to fit into the pane. When the pane is big enough the tooltip does not appear. The tooltip is simply a copy of the text in the pane and the user sets this by calling set_status_text@.
This will probably not work with the first pane and %`sb where menu item info is controlling the content of the pane.
I have added this style but it may not be of much interest to users. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2393 Location: Yateley, Hants, UK
|
Posted: Fri May 03, 2019 9:41 am Post subject: |
|
|
Hi Paul,
Thanks for looking at this.
Eddie |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Fri May 03, 2019 2:22 pm Post subject: |
|
|
I don't know. It's all in the Windows API. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Fri May 03, 2019 3:52 pm Post subject: |
|
|
If I wanted to know if a string will appear without truncation within a pane then I would do something like...
1) get the width of the pane via SendMessage and SB_GETRECT,
2) get the device context of the status bar using GetDC,
3) get the width of the text I want to display via GetTextExtentPoint32,
4) test if the text width is <= the pane width.
You can probably do this in Fortran but it's a lot easier in C. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8037 Location: Salford, UK
|
Posted: Wed May 08, 2019 9:47 am Post subject: |
|
|
Can anyone else help John with the details? |
|
Back to top |
|
|
|