[help] how to write a basic scroolbar in a sub-win by using masm32 please?

Started by winge, February 02, 2005, 07:22:30 PM

Previous topic - Next topic

winge

:red hi, i am new to masm32. these days i was trying to figure out how write a scrool bar by using masm32. could some one show me a way or share me a small example about how to write a simple scrool bar (like a vertical scrool bar) into a sub-windows please? many thanks to you! any help will be pleased.

petezl

Hi winge,
Scroll bars are quite easy to do. Here it is shown in a Child window creation.
INVOKE CreateWindowEx,NULL,ADDR EditClass,NULL,\
                   WS_VISIBLE or WS_CHILD or ES_LEFT or ES_MULTILINE or\
                   ES_AUTOHSCROLL or ES_AUTOVSCROLL or WS_VSCROLL or WS_HSCROLL,0,\
                   0,0,0,hWnd,EditID,\
                   hInstance,NULL

Peter.
Cats and women do as they please
Dogs and men should realise it.

winge


winge

hi petezl, the scroll bar on my sub-win is up now ... but how can i get it to work please? i cannot scroll down or do other action with it. could you or any one here can help me a bit more please? thank you in advance!

:red the attachment below is so far i got ... if it's possible, i wish someone can help me get the basic scroll function to work (like: scroll down/up ) . thank you:

[attachment deleted by admin]

petezl

Cats and women do as they please
Dogs and men should realise it.

petezl

winge,
I see you have the scrollbar in place but it won't scroll unless there is more text in the window than it can handle.
It's also customary to create this child window as an edit control (in WndProc section) so that it will recieve user input although there are exceptions.
Rather than hack your code around I've attached a bare bones slider demo with commenting.
Hope this helps!
Peter.

[attachment deleted by admin]
Cats and women do as they please
Dogs and men should realise it.

winge

Quote from: Tedd on February 04, 2005, 12:37:44 PM
You have to handle the messages the srcollbar sends back to its parent. A scrollbar itself doesn't actually do anything other than send message to the parent saying "scrolly up!" or such.
You have to do the actual scrolling yourself, in response to these messages - eg. WM_VSCROLL, WM_HSCROLL
Read the whole section on msdn about scrollbars :wink

Tedd, thank you for your advice.

Quote from: petezl on February 04, 2005, 12:46:36 PM
winge,
I see you have the scrollbar in place but it won't scroll unless there is more text in the window than it can handle.
It's also customary to create this child window as an edit control (in WndProc section) so that it will recieve user input although there are exceptions.
Rather than hack your code around I've attached a bare bones slider demo with commenting.
Hope this helps!
Peter.
thank you Peter, your demo is very helpful to me. it's what i want to learn :bg

winge

actually, i am really thinking how to make this possible in masm32. please take a look at: Figure 7.26   Scrolling the bitmap at run time

http://msdn.microsoft.com/library/en-us/vbcon98/html/vbconscrollbarcontrolsscenariocreatingscrollablegraphicsviewport.asp

thank you for your reply :red

petezl

winge,  I can't help you any further with this! I have being playing around with scroll bars and they seem to have a mind of their own.
As soon as you add other windows like Toolbars or Status bars, the scroll bars start acting strangely. The various SB_ and SBM_ messages seem to be ignored.
Peter.
Cats and women do as they please
Dogs and men should realise it.

winge

no problem Peter, you already help me a lot. thank you ! and i will continue to try accomplish it myself  :U