May 10, 2024, 08:04:15 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Spinner(UpDown) Control

Started by LarryMc, August 11, 2008, 05:38:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

Trying to trigger evnt when spinner control changes.

From Bevet's help file:
Quote@UDN_DELTAPOS

Sent by the operating system to the parent window of an up-down control when the position of the control is about to change. This happens when the user requests a change in the value by pressing the control's up or down arrow. The @UDN_DELTAPOS message is sent in the form of a @NOTIFYCODE message.

@LPARAM  [out]

Address of a NMUPDOWN structure that contains information about the position change. The iPos member of this structure contains the current position of the control. The iDelta member of the structure is a signed integer that contains the proposed change in position. If the user has clicked the up button, this is a positive value. If the user has clicked the down button, this is a negative value.
Put in this:
Type NMHDR
    Uint hwndFrom
    Int idFrom
    Int code
EndType

Type NMUPDOWN
    NMHDR hdr
    Int iPos
    Int iDelta
EndType
SETID "UDN_DELTAPOS", 0xFFFFFD2E

and SpinnerControl(win,258,283,20,20,@TABSTOP|0x0002|@UDS_AUTOBUDDY,0,1014)
SetSpinnerBase(win,1014,10)
SetSpinnerRange(win,1014,0,255)
Tried this code and get the same numbers every time I hit a up or down button.CASE @IDCONTROL
SELECT @CONTROLID
CASE 1014
IF @NOTIFYCODE = @UDN_DELTAPOS
temp=new(NMUPDOWN,1)
temp=@LPARAM
print #<NMUPDOWN>temp.ipos      /* 4309160  */
print #<NMUPDOWN>temp.idelta    /* 1014  */
delete temp
ENDIF


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Found the answer.  This works:
SELECT @CONTROLID
    CASE 1014
        If @NOTIFYCODE = @UDN_DELTAPOS
            pos = *<NMUPDOWN>@lparam.iPos)
            delta = *<NMUPDOWN>@lparam.iDelta
        endif


Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

lol.  You beat me to the reply, I was just about to ask why you were doing the NEW.

Normally a spinner control is buddied with an edit control, so you don't need to access the position directly, instead getting the value from the edit box.  If you are not using an edit control then drop the @UDS_AUTOBUDDY style.
Ionic Wind Support Team

LarryMc

I'm playing around with a button designer for my shaded(gradient) buttons.
I do have an edit control as a buddy.

But I want to update the configuration of a sample button real-time while a up/down button is depressed and the number is changing.

Sorry to detract you from what you were working on.

Thanks,

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

Exactly, and the edit control sends a notification when its contents have changed.  So you can adjust with both the spinner and with typed in text.
Ionic Wind Support Team

LarryMc

That's my scheme.

Now , if I can just "gitter done". :D

Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library