Page 1 of 5
Slider question
Posted: Tue Mar 22, 2016 2:03 am
by jdsoft
Hello,
Is it possible to build a slider in Express as presented in this sample?
Suggestions are very welcome
Re: Slipder question
Posted: Tue Mar 22, 2016 5:54 am
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
Re: Slipder question
Posted: Tue Mar 22, 2016 6:17 am
by Tom
Take a static and paint on it.

Re: Slipder question
Posted: Tue Mar 22, 2016 6:35 am
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.
Re: Slipder question
Posted: Tue Mar 22, 2016 9:05 am
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.
Re: Slipder question
Posted: Wed Mar 23, 2016 12:04 am
by Auge_Ohr
what about a "real" Trackbar ( Slider ) ?
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

- DXEslider.jpg (15.59 KiB) Viewed 18110 times
try it ... still under Construction
- DXESLIDE.ZIP
- need ot4xb
v1.9.355 - (27.59 KiB) Downloaded 1032 times
Re: Slipder question
Posted: Thu Mar 24, 2016 2:14 am
by Auge_Ohr
here i have fixed some Code and include READ.ME

- DXEslider2.jpg (41.62 KiB) Viewed 18085 times
any Comments ?
Re: Slipder question
Posted: Thu Mar 24, 2016 7:13 am
by rdonnay
What is DXESLIDE.LIB and DXESLIDE.DLL ?
Where do they come from?
Re: Slipder question
Posted: Thu Mar 24, 2016 11:18 am
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 )
Re: Slipder question
Posted: Thu Mar 24, 2016 11:40 pm
by Auge_Ohr
next Step : Customdraw for Slider (TBCD_THUMB only)

- DXEslider3.jpg (9.61 KiB) Viewed 18050 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 ?
