News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Test a toy for me.

Started by hutch--, June 26, 2005, 02:07:27 AM

Previous topic - Next topic

hutch--

The attached file is a test piece for the selection code I had posted before and now has the added capacity to draw buttons, move them using the mouse and size and micro adjust their position using the arrow keys. The arrow keys are used by themselves to microadjust the position and if the shift key is also used, it changes either the width or the height of the button that has the focus.

I have tested it on win98se and win2k sp4 and it appears to be working correctly.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

I don't currently have an XP installation, but under Windows 2000 it seems to work OK. I can drag the mouse to draw a button, and after release I can move or delete the button. I don't know if this means anything, but it misbehaves when I drop a button on another button. The image of the dropped button remains visible in the button it was dropped on until I force a redraw by attempting to drag the button out of the window, and then back in.


eschew obfuscation

hutch--

Michael,

Thanks for running the example, the redraw has not been handled yet but I am interested in if the sizing and moving with the arrow keys and shift are working OK as well.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Phil

Seems to work fine under XP. I did manual resizing, maximizing, minimizing, and shifted thru the menu items with the arrow keys after an initial click on the file item. I'm not sure if you meant test sizing the window by using the arrow keys ... if you did then I don't know how to do or test that. The buttons all displayed their message box when I clicked on them and they didn't display the message if I moved the pointer off of the button before releasing the mouse button. Looks like you have grouping built into the buttons as well. I didn't notice any overlap or bad behavior when I made the window small.

hutch--

Sorry Phil,

I should have made sense of the request. The keyboard moving and sizing is for the button that has the focus, arrow keys move it an Shift + arrow keys size the button.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

MichaelW

Hutch,

Sorry, I don't multitask as well as I used to :lol

Sizing/moving with the arrow keys works OK and the increment per keystroke seems just about right.
eschew obfuscation

Eóin

Hi hutch--, I'm running XP and resizing buttons doesn't seem to work. Using shift + an arrow key just moves a button.

hutch--

Eóin,

Thanks for running the test, tel me this much, do the arrow keys by themselves move the button once it is drawn or only with the Shift key pressed ?

This is the code I am using in the button subclass to handle the keys.


        invoke GetKeyState,VK_SHIFT
        rol eax, 16
        cmp ax, 1111111111111111b
        jne over

        switch wParam           ; change size
          case VK_LEFT
            sub pt2.x, 1
          case VK_RIGHT
            add pt2.x, 1
          case VK_UP
            sub pt2.y, 1
          case VK_DOWN
            add pt2.y, 1
        endsw
        jmp past

      over:
        switch wParam           ; move position
          case VK_LEFT
            sub pt1.x, 1
          case VK_RIGHT
            add pt1.x, 1
          case VK_UP
            sub pt1.y, 1
          case VK_DOWN
            add pt1.y, 1
        endsw

      past:
        invoke MoveWindow,hCtl,pt1.x,pt1.y,pt2.x,pt2.y,TRUE


Is there anything about your XP seteup that is unusual, keyboard etc ....
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

RuiLoureiro

Hi,
    I tested in my XP and it works well with and without shift, moving the created button up, down, left and right. It doesnt do anything else.

Eóin

I don't think I've any special setup, the arrow keys move the highlighted button regardless if shift is pressed or not.

hutch--

OK Guys,

Thanks for testing this out, it looks like XP does something different with GetKeyState().
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

doomsday

Hi Hutch,

I'm playing with it on XP.

To add to MichealW's post, I think it might be a problem with the focus.  If you drop buttonA on top of buttonB then drag buttonB with the mouse then buttonB doesn't appear to be redrawn.

regards,
-Brent

AeroASM

1. I also have WinXP, and Shift doesn't affect anything.

2. When Button B is dropped on top on Button A, when you try to drag Button B, it instead drags Button A which is underneath.

jojo

Hutch, Shift works fine on my XP installation with a Swiss-German keyboard.

hutch--

Thanks jojo.

There is no code specific to the button on top of another so it will not handle redraws in that context but what I am testing is whether the shift key effects the movement and sizing of each button and it appears to be inconsistent on XP depending on which version is used. It seems that all version still send the arrow key data with the WM_MOUSEMOVE message but it seems that the return value from GetKeyState() may be treated differently on different versions.

What the code should do wth the Shift key pressed and the arrow keys used is change the size of the button that has the focus so it appears that that option is not being taken with the API I have used or alternatively I may not be using the return value corectly. I will see if there is a way to use GetAsyncKeyState() instead as I have had no problems with it in other contexts.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php