Announcement

Collapse
No announcement yet.

Can I split a spinbox control?

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

  • Can I split a spinbox control?

    Is it possible to split a spinbox control ("msctls_updown32") in 2 separate arrow buttons (left and right, using %UDS_HORZ-style)? I want a "home"-button in between. As normal the left arrow will count down, the right one up and the button in the middle should restore the initial setting of the counter.

    Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
    http://zijlema.basicguru.eu
    *** Opinions expressed here are not necessarily untrue ***

  • #2
    How about three side-by-side tiny button controls? To get the arrow keys you'll have to subclass but AFAIK updown controls are bipolar only,

    (Us sytle BS_BITMAP, and the arrow BMPs are standard ones you can load with LoadBitmap or LoadImage).


    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      It's fairly simple to use regions.
      You simply remove the unwanted part.
      Of course you need to calculate all kind of things.
      hellobasic

      Comment


      • #4
        Here it is:

        Code:
            Local hWndCtrl As Long
            Local hRgn As Long
            Local R As RECT
        
            Select Case nCbMsg
            Case %WM_INITDIALOG
            
                hWndCtrl = GetDlgItem( CbHndl, %ID_FORM1_UPDOWN1 )
            
                GetWindowRect( hWndCtrl, R )    
                hRgn = CreateRectRgn( 0, 0, R.nRight - R.nLeft, ( R.nBottom - R.nTop ) / 2 )
                SetWindowRgn( hWndCtrl, hRgn, 1 )
        hellobasic

        Comment


        • #5
          Unfort. standard arrow bmps are scrollbar arrows

          Thanks guys,

          Michael: I've tried the standard bitmaps (%OBM_LFARROW et cetera), but it is not possible to enlarge them. So what you get is the scrollbar size arrow, which is too small in comparision to its neighbouring buttons.

          Edwin: I'll try your suggestion tomorrow. The spinbox arrows can be resized, therefore I prefer a "split solution" with those bitmaps.

          Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
          http://zijlema.basicguru.eu
          *** Opinions expressed here are not necessarily untrue ***

          Comment


          • #6
            ???
            CONTROL ADD IMGBUTTONX didn't stretch the arrow image?
            Dale

            Comment


            • #7
              Hello Dale,

              The so called standard bitmaps in Windows need to be loaded using LoadBitmap or LoadImage (API functions) and then should be sent (SendMessage) to a bitmap style button control (%BS_BITMAP). One cannot use CONTROL ADD IMGBUTTON(X).

              Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
              http://zijlema.basicguru.eu
              *** Opinions expressed here are not necessarily untrue ***

              Comment


              • #8
                Edwin's idea does not work

                Well, it's a couple of days later than "tomorrow", but today I've tried Edwin's suggestion. It does not work quite well. I only can use one half of the same control. Maybe I should use the halfs of 2 different spinners? I'll give it a try, but perhaps it is a lot simpler to create my own IMAGEX arrow buttons, using an image editor.

                Egbert Zijlema, journalist and programmer (zijlema at basicguru dot eu)
                http://zijlema.basicguru.eu
                *** Opinions expressed here are not necessarily untrue ***

                Comment

                Working...
                X