Slider question

This forum is for eXpress++ general support.
Message
Author
User avatar
jdsoft
Posts: 113
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

Slider question

#1 Post by jdsoft »

Hello,
Is it possible to build a slider in Express as presented in this sample?

Image

Suggestions are very welcome
Regards,
Jack Duijf

User avatar
sdenjupol148
Posts: 151
Joined: Thu Jan 28, 2010 10:27 am
Location: NYC

Re: Slipder question

#2 Post by sdenjupol148 »

Hey Jack,

The closest thing I use is DCSCROLLBAR but is only has one slider per bar; maybe there's some magic Roger can add.

Bobby

User avatar
Tom
Posts: 1173
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Slipder question

#3 Post by Tom »

Take a static and paint on it. ;)
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Tom
Posts: 1173
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Slipder question

#4 Post by Tom »

To be a little more precise:

There is a rounded box with a shadow. This could be painted using (two) GraBox(es). There is another blue box inside, showing the selected area. This is a GraBox aswell (or two on top of each other, if you need the shadows). There are four numbers - GraCaptionStr is what you need for this. You have two pointers. Use icons or bitmaps for those - with transparent backgrounds. You may even paint those pointers, but it would be easier to place icons or bitmaps.

Create a class for this, use DCSTATIC as the base class. Paint it all again if needed - the painting method will be the biggest thing here. Add a handler and find out a) where the mouse is and b) if it's clicked or held on a pointer. Move the Icons or Bitmaps with the mouse, but only on the base line. This is a little work, but you may be able to reuse the controle everywhere you need it. eXpress++ will reflect it perfectly when using the subclass clause of DCSTATIC.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Slipder question

#5 Post by rdonnay »

If you give me a day or two, I will create a subclass for DCSTATIC that will use the same technique as DC_XbpSplitBar(). It will require custom lbDown, lbUp, and Motion methods that will capture the mouse.

I would think that Gra*() functions are not needed here. Instead, I visualize 6 statics. The sliders will be statics that have a caption for the number and a child static for the slider image. I visualize the slider image as just a bitmap with a transparent background.

This should require no changes to eXpress++ code, only a new subclass: MySlider.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Slipder question

#6 Post by Auge_Ohr »

what about a "real" Trackbar ( Slider ) ?
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
DXEslider.jpg
DXEslider.jpg (15.59 KiB) Viewed 14531 times
try it ... still under Construction ;)
DXESLIDE.ZIP
need ot4xb
v1.9.355
(27.59 KiB) Downloaded 791 times
greetings by OHR
Jimmy

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Slipder question

#7 Post by Auge_Ohr »

here i have fixed some Code and include READ.ME
DXEslider2.jpg
DXEslider2.jpg (41.62 KiB) Viewed 14506 times
any Comments ?
Attachments
DXESLIDE2.ZIP
DLL / LIB v1.9.355
need ot4xb
(36.46 KiB) Downloaded 736 times
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4733
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Slipder question

#8 Post by rdonnay »

What is DXESLIDE.LIB and DXESLIDE.DLL ?

Where do they come from?
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Slipder question

#9 Post by Auge_Ohr »

rdonnay wrote:What is DXESLIDE.LIB and DXESLIDE.DLL ?
Where do they come from?
like all in my DXE LIB it is "pure" Xbase++ Code with ot4xb to access Windows Common Control which i have put into LIB / DLL to testdrive.

Code: Select all

   ::hSlider := @user32:CreateWindowExA(0 ,; // extended styles
                      TRACKBAR_CLASS      ,; // control 'class' name "msctls_trackbar32"
                      ""                  ,; // control caption
                      ::dwLvStyle         ,; // wnd Style
                      aRC[1],aRC[2],aRC[3],aRC[4],; // position: left,top,width,height
                      ::hXbp              ,; // parent window handle
                      APP_ID_SLIDE        ,; // control's ID
                      AppInstance()       ,; // instance Ot4Xb -> GetModuleHandleA()
                      0)                     // user defined info
i can share Source Code on Request after finish Control ... still some Work todo.

i like to ask if Control does work as expect ? what is missing ? how does User want to "set" Ticks ?

under Construction : Customdraw ( Ownerdraw )
greetings by OHR
Jimmy

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Slipder question

#10 Post by Auge_Ohr »

next Step : Customdraw for Slider (TBCD_THUMB only)
DXEslider3.jpg
DXEslider3.jpg (9.61 KiB) Viewed 14471 times
i have paint a eclipse and filled with Color (CYAN).

Code: Select all

DO CASE
      CASE nStage == CDDS_PREPAINT        // Before the paint cycle begins
      CASE nStage == CDDS_PREERASE        // Before the erase cycle begins
      CASE nStage == CDDS_POSTERASE       // After the erase cycle is complete
      CASE nStage == CDDS_ITEMPREERASE    // Before an item is erased
      CASE nStage == CDDS_ITEMPOSTERASE   // After an item has been erased
      CASE nStage == CDDS_ITEMPREPAINT    // Before an item is drawn
         DO CASE
            CASE itemSpec = TBCD_CHANNEL  // channel that the trackbar control's thumb marker slides along
            CASE itemSpec = TBCD_TICS     // the increment tick marks that appear along the edge of the trackbar control
            CASE itemSpec = TBCD_THUMB    // trackbar control's thumb marker. 
                                          // This is the portion of the control that the user moves
            // Color Frame
               hPen   := @Gdi32:CreatePen(PS_SOLID,1,AutomationTranslateColor(GraMakeRGBColor({255,0,0}),.F.))
               @Gdi32:SelectObject(hdc, hPen)
               @GDI32:SetBkColor(  hdc, AutomationTranslateColor(GraMakeRGBColor({0,255,0}),.F.))
            // Color to fill
               hBrush := @Gdi32:CreateSolidBrush(AutomationTranslateColor(GraMakeRGBColor({0,0,255}),.F.))
               @GDI32:SelectObject(hdc,hBrush)
            // paint Eclipse
               @GDI32:Ellipse(hDC,rc:left,rc:top,rc:right,rc:bottom)
            // clean up
               @gdi32:DeleteObject( hPen )
               @gdi32:DeleteObject( hBrush)
               RETURN CDRF_SKIPDEFAULT    // don't let control draw itself, or it will un-do our work
         ENDCASE

      CASE nStage == CDDS_ITEMPOSTPAINT   // After an item has been drawn
      CASE nStage == CDDS_POSTPAINT       // After the paint cycle is complete
         RETURN CDRF_DODEFAULT
   ENDCASE

RETURN NIL
to activate Customdraw for Slider set

Code: Select all

o:Drawmode := XBP_DRAW_OWNERADVANCED
! Note : Customdraw is other than XbpBrowse():Customdraw Slot and does not have a Callback Slot.
i have search for "old Style" Ownerdraw Sample but not found yet ... all are using Customdraw now.

todo :
TBCD_CHANNEL and TBCD_TICS
Bitmap ? visual Style ?

Question : how User want to "set" Tick Marker ? o:RbDown ?
Image
Attachments
DXESLIDE3.ZIP
DLL / LIB v1.9.355
need ot4xb
(41.41 KiB) Downloaded 746 times
greetings by OHR
Jimmy

Post Reply