News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How did button animation work ??

Started by Rockphorr, August 02, 2023, 06:39:51 AM

Previous topic - Next topic

Rockphorr

Hi!
I try create my own style of buttons like win95 start.
When user click on button the button content (text or image or both) diagonal move down on few dots.
I just subclass button with icon by change winproc routine to:

my_winproc()
 call std_button_winproc
 call draw_text

It looks like


I need specs how to move the content of button cause my text on the button does not move when the button is pressed.

jj2007

Buttons are notoriously difficult. It will definitely be an ownerdraw button, and you need a flag that gets set when your button subclass registers WM_LBUTTONDOWN/UP. With this flag, you can decide to draw your text some pixels lower or to the left, which colour to choose in pressed/released state, etc.

If you have a test case, post it here, and we'll try to see what's possible :thup:

Rockphorr

Is it correct - I assume that i need to get some frame and output there and Windows would change coords of the frame when button is pressed ?

Rockphorr

Quote from: zedd151 on August 02, 2023, 08:12:22 AMSome possible ideas for you, Rockphorr...
Use could use bitmaps one for "up" one for "down".
There is an example of that in \masm32\examples\exampl01\bmbutton
That example is also attached...
You can use your own images
In your case, just add text to the images.


Another similar example in \masm32\examples\exampl03\bmpbutn
and .... text menubar buttons, etc. ... \masm32\examples\exampl07\skins3

Thanks, I will see it.

If I add text to the images - it restricts a loading titles from config file. It is not good.

zedd151

#4
Quote from: Rockphorr on August 02, 2023, 09:22:02 PMThanks, I will see it.

If I add text to the images - it restricts a loading titles from config file. It is not good.
Ah, okay. Seems that you want to use owner drawn buttons? I have no experience using any owner drawn functions. Perhaps another member might know how to help with that.
Do you have some code started?
What I understand so far, is that you want an image and text on the button. Also the text can be changeable...
Is that correct? I have only done buttons with either text or bitmaps. Sometimes I have used bitmaps with text on the bitmap as well. Therefore I though one of the Masm32 examples could help you, but seems you are looking for something different than that...

jj2007

#5
Google ODA_DRAWENTIRE "button"

You may study the behaviour of coloured rounded buttons.

Rockphorr

Quote from: zedd151 on August 02, 2023, 09:36:40 PM
Quote from: Rockphorr on August 02, 2023, 09:22:02 PMThanks, I will see it.

If I add text to the images - it restricts a loading titles from config file. It is not good.
Ah, okay. Seems that you want to use owner drawn buttons? I have no experience using any owner drawn functions. Perhaps another member might know how to help with that.
Do you have some code started?
What I understand so far, is that you want an image and text on the button. Also the text can be changeable...
Is that correct? I have only done buttons with either text or bitmaps. Sometimes I have used bitmaps with text on the bitmap as well. Therefore I though one of the Masm32 examples could help you, but seems you are looking for something different than that...

Yes, I load icon and link it with button, than i ask for winproc and save its addr, change winproc to mine, and call it from mine with text draw. My code style is like dos, so if it is ok i post my code here. It is for Windows 95, it is old and abadoned, but it is enougth for me.

Regards.

zedd151

Sure, post what you have. Even if I cannot help, there may be others that can help you to acheive your goal.  :smiley:

Rockphorr

Here is most sense fragment ....
You cannot view this attachment.

...feedbacks are welcome :)

This topic continues that https://masm32.com/board/index.php?topic=10233.msg111622#msg111622

So ...
Quote from: NoCforMe on August 04, 2022, 09:59:16 AM
QuoteIt is my dos legacy code style.

Bzzzzzt! Bad answer. So you're coding as if you're still writing for the 8088, where you couldn't push constants (or do a lot of other things). So basically you're wearing blinders, saying "La la la la la" while you ignore all the advances that have been made since those days.

...

But my code looks similar that you see in debuger .... so it is comfortable.

I do not like push constants - i do it through registers. sometimes it is more short like xor eax,eax push eax than push 0.

NoCforMe

Quote from: Rockphorr on August 03, 2023, 03:00:09 AMBut my code looks similar that you see in debuger .... so it is comfortable.

So you can only code what looks exactly like what you see in the debugger? Weird ...

QuoteI do not like push constants - i do it through registers. sometimes it is more short like xor eax,eax push eax than push 0.

No, "xor eax,eax/push eax" is NOT "more short" (shorter) than "push 0".
Assembly language programming should be fun. That's why I do it.

Rockphorr

Quote from: NoCforMe on August 15, 2023, 09:23:00 AMSo you can only code what looks exactly like what you see in the debugger? Weird ...

What is weired ?  I code that look almost like that it is in the debuger. Otherwise c or c++ why not ? Or may be .... python ???? Using .IF of masm or if{} of c we fogot how conditional jumps looks like.

Rockphorr

I found that Windows 95 button draw functions are located in user.exe
Think about debug around the origin button winproc and make my button similar.