Announcement

Collapse
No announcement yet.

up down control

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stuart McLachlan
    replied
    Originally posted by Michael Mattias View Post
    And if there is some compiler confusion anyway... we should be here to help, not to keep score or accumulate "gothcas." .
    There's a difference between "gotchas" and "these are the errors you are making". Hopefully,the latter is a learning opportunity.

    Leave a comment:


  • Michael Mattias
    replied
    This is totally incorrect.

    When the use clicks the up or down pointing arrow button, the control sends a UDN_DELTAPOS notification messag
    Stuart, this language is that of a Microsoft Visual Basic refugee, and in that context it is NOT "totally incorrect." Frankly it looks like EXACTLY how that product would describe the operation of the SysUpdown32 control. And if there is some compiler confusion anyway... we should be here to help, not to keep score or accumulate "gothcas." .

    MCM

    Leave a comment:


  • Stuart McLachlan
    replied
    Originally posted by Dale Yarker View Post
    ??????????????????????????????????????????????????????
    Why did you put that code here after necro posting it in Programming?
    A demo of all the things that you shouldn't do?
    Posting in an inappropriate forum area
    Duplicate posting
    Not wrapping code in [code]....[/code] tags

    Lots of coding problems:

    using the "no longer supported" CbHndl
    Not setting buddy initially which results in first UpDown click not being recognised
    sending %UDM_SetBuddy on every WM_COMMAND message to the UpDown control
    passing the out of range 33333333320 as the low 16 bits of MAK(LONG...)
    Using MAK(LONG) with SETRANGE32 instead of just passing a long. (MAK(LONG) is only useful with SETRANGE)
    Declaring la as as SINGLE to store long integer UPDOWN position values
    Assigning a value to la but never using it
    Declaring temp$ and not using it
    Using "magic number" control IDs after assigning meaningful equates
    (That'll do for now)

    Leave a comment:


  • Dale Yarker
    replied
    ??????????????????????????????????????????????????????
    Why did you put that code here after necro posting it in Programming?

    Leave a comment:


  • James C Morgan
    replied
    CODE:
    #Compile Exe
    #Dim All
    #Include "Win32API.inc"
    #Include "commctrl.inc" '<--- include to work in PBWin9 DID NOT TRY IN PBWIN9 RUNS IN MY PBWIN10.3

    %IDC_TextBox = 500
    %IDC_UpDown = 501
    Global Hdlg As Dword
    Global sd , sa As String
    Global la As Single

    Function PBMain() As Long
    Dialog New Pixels, 0, "Up-Down Control",300,400,240,175, %WS_OverlappedWindow To Hdlg
    Control Add TextBox, Hdlg, %IDC_TextBox, sa, 50,20,150,40,,%WS_EX_TRANSPARENT
    ShowWindow GetDlgItem( Hdlg, 500 ), %SW_HIDE '%SW_SHOW
    ' Control Add Label, Hdlg, 502,"0", 20,10,150,30
    Control Add TextBox, Hdlg, 502, sd, 50,80,150,40

    Control Add "msctls_updown32", Hdlg, %IDC_UpDown, "", 195, 20, 38, 38, %WS_Child Or %WS_Border _
    Or %WS_Visible Or %UDS_ArrowKeys Or %UDS_SetBuddyInt 'Or %UDS_AlignRight
    Control Send Hdlg, %IDC_UpDown, %UDM_Setpos32, 0, 15
    'Sets starting pos32
    Control Send Hdlg, %IDC_UpDown, %UDM_SetRange32, 0, Mak(Long,33333333320,0)
    ' Sets range 32
    Dialog Show Modal Hdlg Call DlgProc
    End Function


    CallBack Function DlgProc() As Long
    Local temp$

    If CB.Ctl = %IDC_UpDown Then

    Control Send CbHndl, %IDC_UpDown, %UDM_SetBuddy, GetDlgItem(Hdlg, 500), 0
    'Sends to 500 which is hidden

    'Moves From 500 To Visible 502
    Control Get Text CbHndl, 500 To sd
    Control Set Text CbHndl, 502, sd

    la = val(sd)
    'Convert from a string to a number

    Exit Function

    End If

    End Function
    ' Thanks gBeenE For The Start

    Leave a comment:


  • Stuart McLachlan
    replied
    I've just posted a minimalist demonstration of using an UpDown control in the Source Code forum (PBWin - DDT).
    https://forum.powerbasic.com/forum/u...emo#post800033

    No need to trap notification methods or work out which button was clicked, it all happens automagically when the UpDown control updates its buddy textbox.

    Leave a comment:


  • Stuart McLachlan
    replied
    Originally posted by James C Morgan View Post
    The up-down Control makes an Object distinction between its Button components.
    For example, when the User clicks the up pointing arrow Button,
    the Control fires the UpClick() event. On the other hand,
    when the User clicks the down pointing arrow Button,
    the Control sends a DownClick() event. These allow you To treat each event separately If you want.
    This is totally incorrect.

    When the use clicks the up or down pointing arrow button, the control sends a UDN_DELTAPOS notification message. The associated NM_UPDOWN structure contains information you can use to determine which arrow was clicked (the iDelta member)

    Leave a comment:


  • Stuart McLachlan
    replied
    Is there a question in this thread, or is it just a random incorrect statement about a "non-PB" Window's control?

    Leave a comment:


  • Michael Mattias
    replied
    For example, when the User clicks the up pointing arrow Button,
    the Control fires the UpClick() event. On the other hand,
    when the User clicks the down pointing arrow Button,
    the Control sends a DownClick() event. These allow you To treat each event separately If you want.
    PB/Windows (the compiler you are thinking of), does not support a "PB Native" Updown control, so you will have to use the 'CONTROL ADD classname ' statement to incorporate an updown (aka "spinner") control into your DDT dialog. Those "events" you reference do not occur. (They would not occur even if PB/Windows supported a native updown control).

    PB/CC does not offer 'DDT' in any event, but it does support all the Windows' API window management functions.

    The updown control is a standard Microsoft Common Control and there are some examples here on the BBS. (I have one right here... I used an updown control even though the demo was for the use of the waitable timer object).

    Waitable Timer Object Demo June 2005

    That thread also has a PB/Win 10 version added later by a couple of users.



    MCM

    Leave a comment:


  • Dale Yarker
    replied
    ????
    Why is this not in PowerBASIC For Windows section?

    PBCC does not have controls.

    This and the other day; do you not realize there are two separate compilers?

    Cheers,

    Leave a comment:


  • James C Morgan
    started a topic up down control

    up down control

    The up-down Control makes an Object distinction between its Button components.
    For example, when the User clicks the up pointing arrow Button,
    the Control fires the UpClick() event. On the other hand,
    when the User clicks the down pointing arrow Button,
    the Control sends a DownClick() event. These allow you To treat each event separately If you want.
Working...
X