IonicWind Software

IWBasic => GUI Central => Topic started by: LarryMc on August 11, 2008, 05:38:07 PM

Title: Spinner(UpDown) Control
Post by: LarryMc on August 11, 2008, 05:38:07 PM
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
Title: Re: Spinner(UpDown) Control
Post by: LarryMc on August 11, 2008, 06:23:16 PM
Found the answer.  This works:
SELECT @CONTROLID
    CASE 1014
        If @NOTIFYCODE = @UDN_DELTAPOS
            pos = *<NMUPDOWN>@lparam.iPos)
            delta = *<NMUPDOWN>@lparam.iDelta
        endif


Larry
Title: Re: Spinner(UpDown) Control
Post by: Ionic Wind Support Team on August 11, 2008, 06:25:59 PM
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.
Title: Re: Spinner(UpDown) Control
Post by: LarryMc on August 11, 2008, 06:42:49 PM
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
Title: Re: Spinner(UpDown) Control
Post by: Ionic Wind Support Team on August 11, 2008, 06:44:31 PM
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.
Title: Re: Spinner(UpDown) Control
Post by: LarryMc on August 11, 2008, 06:52:57 PM
That's my scheme.

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

Larry