CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    UK (South)
    Posts
    93

    CSpinButtonCtrl's can they be trusted?



    I have many problems with this seemingly inocent little fella!


    The function GetPos() and SetPos() return 16bits out ie actual iPos + 65536.


    The iPos icrement is unreliable when compared to the iDelta value.


    And the iDelta value is arse about face ie when you click down it is +1 and when you click up it is -1.


    Does anyone else ever have these problems?


    Simon Pettman

    Research Engineer

    Goodmans Loudspeakers Ltd

    [email protected]



  2. #2
    Join Date
    Apr 1999
    Location
    Alabama
    Posts
    20

    Re: CSpinButtonCtrl's can they be trusted?



    The position values returned from GetPos and SetPos are stored in the low-order word. The high-order word is nonzero if an error occured, else it is zero. The control returns an error if there is no buddy window or if the caption specifies an invalid or out-of-range value. To retrieve the position you would have to use the LOWORD() macro.


    Hope this helps,

    Gary Kirkham



  3. #3

    Re: CSpinButtonCtrl's can they be trusted?

    As far as the fact that they spin arse backwards, this is what I always do in my dialog's OnInitDialog( ):

    // Typical brain-dead Microsoft product spins reversed by default.
    static_cast<CSpinButtonCtrl*> (GetDlgItem(IDC_SPIN_MAXMERGE))->SetRange(1, UD_MAXVAL);

    HTH.


    LA Leonard - Definitive Solutions, Inc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured