Click to See Complete Forum and Search --> : CSpinButtonCtrl's can they be trusted?


Simon Pettman
April 1st, 1999, 08:54 AM
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

pettman.s@gll.co.uk

Gary Kirkham
April 1st, 1999, 09:23 AM
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

LALeonard
April 8th, 1999, 12:37 PM
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.