The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Roger on November 19, 2008, 12:11:59 AM

Title: Status Bar of many parts
Post by: Roger on November 19, 2008, 12:11:59 AM
Hi All,

I have a status bar with several parts and I can set text in these. I also want to put help messages into one of them using Invoke MenuHelp and I have this working. However MenuHelp seems to assume that I have a simple one part status bar.  Does anyone know how I can tell MenuHelp which part to use.

Regards Roger
Title: Re: Status Bar of many parts
Post by: donkey on November 19, 2008, 12:39:50 AM
Hi Roger,

There is no way to specify which part you want to use, why would you want to use such a limited helper function anyway ? Even Raymond Chen dislikes the function...

http://blogs.msdn.com/oldnewthing/archive/2006/06/08/622194.aspx

Quote from: The old new thingThe MenuHelp function is one of the more confusing ones in the common controls library. Fortunately, you will almost certainly never had need to use it, and once you learn the history of the MenuHelp function, you won't want to use it anyway.
Title: Re: Status Bar of many parts
Post by: Tedd on November 19, 2008, 03:11:57 PM
You don't. The intention is that you set the statusbar into 'simple' mode (with SB_SIMPLE) to display the help strings for the menus, and then deactivate simple mode afterward. It's a separate mode, so you don't lose your multipart settings - when you return to non-simple mode you get back the state you had before entering simple mode.
Title: Re: Status Bar of many parts
Post by: Roger on November 19, 2008, 10:52:20 PM
Hi All

Quote from: donkey on November 19, 2008, 12:39:50 AM
There is no way to specify which part you want to use,
Rather as I suspected

Quote
why would you want to use such a limited helper function anyway ?
Why Not? To be more precise: What is there that could have told me that I did not want to use it? I got it from the example code I started with (Alive and Kicking ~ W.J. Radburn), it is documented in the SDK and, until now, did what I wanted it to do.

Quote
Even Raymond Chen dislikes the function...

http://blogs.msdn.com/oldnewthing/archive/2006/06/08/622194.aspx

Quote from: The old new thingThe MenuHelp function is one of the more confusing ones in the common controls library. Fortunately, you will almost certainly never had need to use it, and once you learn the history of the MenuHelp function, you won't want to use it anyway.
He is wrong here, learning its history had no effect on my desire to use it on not use it. No more did his function HANDLE_WM_MENUSELECT because I cannot find out anything about it.

Regards Roger
Title: Re: Status Bar of many parts
Post by: xandaz on June 27, 2010, 02:32:49 PM
   Hi there. I was making a status bar and when i sent SB_SETPARTS things didn't go as i expected. What's the lParam array like? Is it something like:
WidthsArray  dd   200,10,-1 ?
or is RECT like coordinated?
   Thanks guys
Title: Re: Status Bar of many parts
Post by: Tedd on June 27, 2010, 03:57:35 PM

.data
sb_parts        dd 120,200,-1
SBAR_NUMPARTS equ ($-OFFSET sb_parts)/4


.code
;...in WM_CREATE...
        invoke CreateStatusWindow, WS_VISIBLE or WS_CHILD or SBARS_SIZEGRIP,NULL,hwnd,IDSBAR
        mov hSBar,eax
        invoke SendMessage, hSBar,SB_SETPARTS,SBAR_NUMPARTS,ADDR sb_parts


and remember to pass on WM_SIZE messages:
    invoke SendMessage, hSBar,WM_SIZE,wParam,lParam
Title: Re: Status Bar of many parts
Post by: xandaz on June 27, 2010, 06:16:44 PM
   What i did was more or less the same except for the wm_size message. I tried it but doesn't work anyway. Damn
   Ty anyway.
Title: Re: Status Bar of many parts
Post by: xandaz on June 27, 2010, 07:29:28 PM
    Well... problem solved. The thing is that the widths come in client coordinates and i was doing something like Widths dd 32,32,200,-1 where it shopuld be Widths 32,64,264,-1. Anyway, about the WM_SIZE msg. Why do i need it? Does the status bar add to the original size of the window? Please fell free to answer.
   Thanks Tedd.
    Best regards...:)
Title: Re: Status Bar of many parts
Post by: Tedd on June 28, 2010, 09:53:22 AM
When the size of your window changes, you get a WM_SIZE message. The statusbar fits itself nicely at the bottom of your window - but to do that it needs to know the size of your window. If the size of your window changes, it no longer knows the size of your window.. unless you tell it - which is why you forward the WM_SIZE message; as the parent, you receive the message, and it's up to you to pass it on or resize any of your children.
Title: Re: Status Bar of many parts
Post by: xandaz on June 28, 2010, 06:17:27 PM
   oks Tedd. I'll keep that in mind. Msny thanks :U