Hello
I need a Statusbar control for my little project but i confused.
Why return the second SB_SETTEXT always NULL and the set not the Text.
LOCAL sbParts[2] :DWORD
.if uMsg==WM_INITDIALOG
;--Statusbar
invoke GetDlgItem,hWnd,IDC_STATUSBAR
mov hStatusBar,eax
mov [sbParts+0],150
mov [sbParts+4], 120
invoke SendMessage, hStatusBar, SB_SETPARTS, 2, addr sbParts
invoke SendMessage, hStatusBar, SB_SETTEXT, 0, chr$ ("Part 1")
invoke SendMessage, hStatusBar, SB_SETTEXT, 1, chr$ ("Part 2")
Thank you in forward,
try the following instead of GetDlgItem - might be the statusbar in your resource is set as a SB_SIMPLE (simple one part statusbar), so therefore it only sees one part for the bar and ignores the other parts?
Invoke CreateStatusWindow, WS_CHILD or WS_VISIBLE or WS_CLIPCHILDREN or SBS_SIZEGRIP, NULL, hWnd, IDC_STATUSBAR
mov hStatusBar,eax
Hello Fearless :biggrin:
Its same with you solution the second return 0 and set not the Text.
I think this is a simply Mistake but i cannot find this little bug. ::)
(http://fs5.directupload.net/images/170412/a9pjxtk5.png)
Check to see if statusbar control is on the dialog in the resource editor, just to remove it for testing and see if its still showing the same.
Ive tested with and without manifests, tried using the CTEXT and chr$ macros just to try and replicate the issue, but cant seem to, all my test produce output in both panels.
Pretty strange tho :D
InitCommonControls is ok?
:biggrin:
Do_Status proc hParent:DWORD
LOCAL sbParts[4] :DWORD
invoke CreateStatusWindow,WS_CHILD or WS_VISIBLE or \
SBS_SIZEGRIP,NULL, hParent, 200
mov hStatus, eax
; -------------------------------------
; sbParts is a DWORD array of 4 members
; -------------------------------------
mov [sbParts + 0], 125 ; pixels from left
mov [sbParts + 4], 250 ; pixels from left
mov [sbParts + 8], 375 ; pixels from left
mov [sbParts + 12], -1 ; last part
invoke SendMessage,hStatus,SB_SETPARTS,4,ADDR sbParts
ret
Do_Status endp
hStatus in this context is a GLOBAL value set in the .DATA? section.
Quote from: ragdog on April 13, 2017, 05:24:16 AMWhy return the second SB_SETTEXT always NULL and the set not the Text.
Ask Windows (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1020), or post your full code.
so with a minimal change to original source:
mov [sbParts+4], -1
Quotemov [sbParts + 12], -1 ; last part
Yes this works fine.
I forgot it :biggrin: