Jump to content

How do you use UpDown styles?


therks
 Share

Recommended Posts

So I've got this UpDown control applied to an edit control. I found out a neat trick with SetLimit (changing the direction the up/down buttons shift the number), but I cannot figure out how to use the styles shown in the docs.

I wanted to use the $UDS_ARROWS style.

First I just tried putting in the CreateUpDown function, but it doesn't accept a 2nd param. So then I tried GuiCtrlSetStyle, but that didn't seem to do anything.

I just realized now that the UDS styles aren't defined in the GUIConstants, but even trying the hex values didn't do anything.

How do I do it?

Here's what I have as an example:

$UDS_ARROWKEYS = 0x20;

GuiCreate('', 200, 200);
$in = GuiCtrlCreateInput('100', 5, 5, 50, 20, $ES_NUMBER);
GuiCtrlCreateUpDown($in);
GuiCtrlSetStyle(-1, $UDS_ARROWKEYS);
GuiCtrlSetLimit(-1, 1000, 0);

Gotta go now, just had to ask this before I headed off to work.

Later all.

Link to comment
Share on other sites

I document in the doc what I think can be used.

THe UDS_ARROWKEYS seems to allow navigation with the keyboard.

Good luck or go to Microsoft MSDN to know more :idiot:

<{POST_SNAPBACK}>

No there's nowhere in the docs that I can see that explains how to apply styles to an UpDown control. There's docs that tell me what styles there are, there's docs on how to apply the UpDown control to an input, but they don't have any style examples. I am just wondering if maybe the GuiCtrlSetStyle function ignores UpDown styles?

UDS_ARROWKEYS - 0x20 - Causes the up-down control to process the UP ARROW and DOWN ARROW keys on the keyboard.

UDS_NOTHOUSANDS - 0x80 - Prevents insertion of a thousands separator between every three decimal positions.

I tried one of the other styles, but nothing seems to work.

#include <GuiConstants.au3>

$UDS_NOTHOUSANDS = 0x80;

GuiCreate('Why doesn''t it work??', 200, 200);
$in = GuiCtrlCreateInput('999', 5, 5, 50, 20, $ES_NUMBER);
$ud = GuiCtrlCreateUpDown($in);
$st = GuiCtrlSetStyle(-1, $UDS_NOTHOUSANDS);
GuiCtrlSetLimit(-1, 2000, 0);

$bt = GuiCtrlCreateButton('Click for info', 80, 5, 70, 20);


GuiCtrlCreateLabel('Click up on the UpDown control. It should display "1000" not "1,000" but it does', 5, 45, 150, 100);

GuiSetState();

Do
    $m = GuiGetMsg();
    if $m = $bt then
        msgbox(0, 'debug', 'input ctrlid = ' & $in & @lf &_
                       'updown ctrlid = ' & $ud & @lf &_
                       'style return value = ' & $st);
    endif

until $m = $GUI_EVENT_CLOSE;

Sorry if I'm being a nuisance, but I really think this should be fixed/addressed before the next release comes out seeing as Jon has frozen it except for bug fixes. At the very least if the styles do not work, then maybe they should be removed from the doc's (although I'd rather if it could be found a way to make them work).

Edited by Saunders
Link to comment
Share on other sites

I get a go around. the style cannot be modified as other style by GuiCtrlSetStyle, so I add a parameter to GuiCtrlCreateUpdown for style definition.

I looks like it is only set at creation time.

THanks for your perseverance, one bug less.

I upload the fix to Jon :idiot:

#include <GuiConstants.au3>

$UDS_NOTHOUSANDS = 0x80

GuiCreate('Why doesn''t it work??', 200, 200);
$in = GuiCtrlCreateInput('999', 5, 5, 50, 20, $ES_NUMBER);
$ud = GuiCtrlCreateUpDown($in);
;$st = GuiCtrlSetStyle(-1, $UDS_NOTHOUSANDS);
GuiCtrlSetLimit(-1, 2000, 0);

$bt = GuiCtrlCreateButton('Click for info', 80, 5, 70, 20);


GuiCtrlCreateLabel('Click up on the UpDown control. It should display "1000" not "1,000" but it does', 5, 45, 150, 100);

GuiSetState();

Do
    $m = GuiGetMsg();
    if $m = $bt then
        msgbox(0, 'debug', 'input ctrlid = ' & $in & @lf &_
                       'updown ctrlid = ' & $ud);
    endif

until $m = $GUI_EVENT_CLOSE;
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...