May 20, 2024, 07:53:12 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


StatusBar and Styles

Started by LarryMc, April 12, 2008, 05:13:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

When I create a @STATUS  control it creates a status bar with a draghandle in the right corner.
Through trial and error I discovered that creating the control with a style of 3 that the draghandle disappears which is what I want.

I tried creating the @status with a style of 0 and then using MODIFYSTYLE to add a style of 3 and it had no impact.

I know I'm doing something wrong but I just don't see what.

Larry

def run:INT
def left,top,width,height:INT
def stattext:STRING
def win:window
def panes[4]:INT

OPENWINDOW win,0,0,640,400,@SIZE|@MINBOX|@MAXBOX,0,"Status Demo",&mainwindow
CONTROL win,@STATUS,"Status",0,0,0,0,0,2
'CONTROL win,@STATUS,"Status",0,0,0,0,3,2
GETCLIENTSIZE win,left,top,width,height
panes = width - 120,width - 80,width - 40,-1
CONTROLCMD win,2,@SWSETPANES,4,panes
stattext = "Client size"+STR$(width)+STR$(height)
CONTROLCMD win,2,@SWSETPANETEXT,0,stattext
CONTROLCMD win,2,@SWSETPANETEXT,1,"Pane 2"
CONTROLCMD win,2,@SWSETPANETEXT,2,"Pane 3"
CONTROLCMD win,2,@SWSETPANETEXT,3,"Pane 4"
MODIFYSTYLE(win,3,0,2)
REDRAWFRAME win, 2

run = 1
waituntil run=0

closewindow win
end

sub mainwindow
select @MESSAGE
case @IDCLOSEWINDOW
run = 0
case @IDSIZE
if CONTROLEXISTS(win,2)
CONTROLCMD win,2,@SWRESIZE
GETCLIENTSIZE win,left,top,width,height
panes = width - 120,width - 80,width - 40,-1
CONTROLCMD win,2,@SWSETPANES,4,panes
stattext = "Client size"+STR$(width)+STR$(height)
CONTROLCMD win,2,@SWSETPANETEXT,0,stattext
endif
endselect
return
ENDSUB
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

I haven't checked the MSDN docs on status bar controls in a long time. 

The one you want to remove is SBARS_SIZEGRIP, whose value is 0x100.   The '3' is a common control style, CCS_BOTTOM, which removing won't do any good as it has to be one of CCS_TOP, CCS_BOTTOM, CCS_RIGHT or CCS_LEFT.

If you're going to be doing a lot of API style coding then I recommend getting the Windows Platform SDK installed on your machine.  Which contains an offline version of MSDN.

You can get them on CD for free here:

http://www.qmedia.ca/launch/psdk.htm

I have the August 2002 version on my drive, which is a little dated but contained info from 9x to XP SP1.  The March 2006 version would be appropriate if you're targeting Win 2000 to server 2003, which includes all of the XP service paks.

You can download the latest SDK right from microsoft as a DVD iso image, provided you have loads of time on your hands and a fast connection ;)

Paul.
Ionic Wind Support Team

LarryMc

Let try to explain my confusion a little better.
When I create a statusbar with:CONTROL win,@STATUS,"Status",0,0,0,0,0,2
and then using:hwnd = GetDlgItem(win.hwnd,2)
current = GetWindowLongA(hwnd,GWL_STYLE)
print ToBase(current,16)

to examine the style gives me "50000000"

That indicates that "child" and "visible" are set but SBARS_SIZEGRIP is not set and CCS_TOP, CCS_BOTTOM, CCS_RIGHT or CCS_LEFT are not set.

But yet I have the statusbar at the bottom of the parent WITH a sizegrip.

So, if I do a modifystyle to remove 0x100 it doesn't change anything because the flag isn't set in the 1st place.
But when I set CCS_BOTTOM the sizegrip disappears.

To me it would seem that that action is an oddity of Windows and a proper action would be for you to set the CCS_BOTTOM flag when a statusbar is created with no flags.

Just my opinion though.

BTW, I am reading the SDK stuff a lot but just don't always understand what I read.  But I'm trying....so I don't get a whipping! ;)

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Larry,
Again that is MSDN.  The default behaviour of a status bar when no style is specified is CCS_BOTTOM | SBARS_SIZEGRIP. 

When you supplied the '3' you changed to CCS_BOTTOM without the sizegrip.  You can still modify the style to add it (0x100) back, but I can't change the default behaviour provided by Microsoft in this case.

Paul.
Ionic Wind Support Team

LarryMc

April 13, 2008, 02:11:26 PM #4 Last Edit: April 13, 2008, 02:16:36 PM by Larry McCaughn
Like I said, a quirk of MS.

In the beginning all I wanted to do was get rid of the sizegrip and I couldn't do it with your MODIFYSTYLE command and
SBARS_SIZEGRIP because, as it turns out, the sizegrip was displayed without its flag being set.

I would expect if the default is the bottom and sizegrip that those 2 flags would be set.
Or that CCS_BOTTOM value would be 0
and/or if you wanted the sizegrip you would set the flag and reset it to get rid of it.

So, for the SBARS_SIZEGRIP to work properly (with the statusbar at the bottom) then CCS_BOTTOM has to be set.

If CCS_BOTTOM isn't set then you can't get rid of the sizegrip by clearing SBARS_SIZEGRIP.

That's why I suggestted that you could add setting  CCS_BOTTOM when you create a @status control like the way you add the child and visible flags automatically.

Not to fix any problem of your making but to make MS's screwup work more like it should have worked to begin with and would also allow your MODIFYSTYLE command to have the expected results.

But then again, this topic in the forum may now be all that is needed for the other person in the universe who might encounter this same issue.

Larry

BTW, the reason I wanted the sizegrip gone was that I changed the color of the statusbar but it wasn't changing the  sizegrips color.
The status bar color can be changed with:CONST SB_SETBKCOLOR = 0x2001
SENDMESSAGE win,SB_SETBKCOLOR,0,RGB(100,200,255),2
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

In many years of programming I've never had the need to remove the sizegrip on a status bar in a sizeable window. ;)

The default allows the sizegrip to be automatic depending on whether the window has @SIZE (WS_SIZE) set or not.  If I were to force the style then it would require the user to use ModifyStyle to turn it off on a fixed sized window.  Not very intuitive.

Paul.
Ionic Wind Support Team