From: Snorik on 18 Dec 2008 04:43 On 18 Dez., 10:06, "Willy" <gru...(a)willygroup.org> wrote: > Hi, > I can't find a simple example for use a trackbar slider. > > I would do a simple dialog with two slider control and two edit control. > When I move the cursor in the edit control I would show the actual position. > When I write a value in the Edit control I would automactly set the cursor > position. Why not use an UpDown? It has the possibility to update another control kind of built in.
From: cathy on 18 Dec 2008 05:37 > Hi, Hi > I can't find a simple example for use a trackbar slider. First you got to initiate with "InitCommonControls();", link "comctl32.lib" and include "commctrl.h" Then you set the range with the "TBM_SETRANGE" message. > I would do a simple dialog with two slider control and two edit control. > When I move the cursor in the edit control I would show the actual position. I guess you mean "When I move the cursor in the slide it displays the value in the edit box". Intercept the slider message "WM_HSCROLL" or "WM_VSCROLL" (according your slider orientation). There get the position of your slide with the "TBM_GETPOS", convert it with "_itow_s" (or "_itoa_s") and then "SetDlgItemText" of your Edit Box. > When I write a value in the Edit control I would automactly set the cursor > position. The opposite so: Intercept the message "EN_CHANGE" of your edit box, there convert the value with "_wtoi" (or "atoi") and use the "TBM_SETPOS" message to change your slider position with this value. Hope this help Cathy
From: Christian ASTOR on 18 Dec 2008 06:00 On 18 déc, 10:06, "Willy" <gru...(a)willygroup.org> wrote: > I can't find a simple example for use a trackbar slider. http://msdn.microsoft.com/en-us/library/cc656639(VS.85).aspx + N. CLUTS samples (slider.c, ...) and as Cathy said for Trackbar thumb position
From: Willy on 19 Dec 2008 02:29 "Willy" <gruppi(a)willygroup.org> ha scritto nel messaggio news:494a12a5$1(a)extreme.x-privat.org... > Hi, > I can't find a simple example for use a trackbar slider. Thanks to all. :) Willy
From: revesz.peter on 23 Dec 2008 12:47 This is What I do: case WM_INITDIALOG: SetSliderRange(GetDlgItem(hDlg, IDC_GAINSLIDER), gainmin, gainmax, gain); ... case WM_HSCROLL: { HWND hwndScrollBar = (HWND) lParam; int iPos = (short int)HIWORD(wParam); if (GetDlgItem(hDlg, IDC_GAINSLIDER)==hwndScrollBar ) { iPos = (int)SendMessage(hwndScrollBar, TBM_GETPOS, 0, 0); gain = iPos; sprintf_s(edtext, EDLEN, "Gain:%d", gain); SetDlgItemText(hDlg, IDC_GAIN, (LPCSTR)edtext); if (LOWORD(wParam)==SB_THUMBPOSITION) { // thumb has been released // Set the gain value now Beep(500,200); } } } ... A helper function: int SetSliderRange(HWND hwndTrack, int iMin, int iMax, int iPos) { SendMessage(hwndTrack, TBM_SETRANGE, (WPARAM) TRUE, // redraw flag (LPARAM) MAKELONG(iMin, iMax)); // min. & max. positions SendMessage(hwndTrack, TBM_SETSEL, (WPARAM) FALSE, // redraw flag (LPARAM) MAKELONG(iMin, iMax)); SendMessage(hwndTrack, TBM_SETPAGESIZE, 0, (LPARAM) (iMax-iMin)/10); // new page size SendMessage(hwndTrack, TBM_SETPOS, (WPARAM) TRUE, // redraw flag (LPARAM) iPos); SetFocus(hwndTrack); return 1; } On Dec 19, 2:29 am, "Willy" <gru...(a)willygroup.org> wrote: > "Willy" <gru...(a)willygroup.org> ha scritto nel messaggionews:494a12a5$1(a)extreme.x-privat.org... > > > Hi, > > I can't find a simple example for use a trackbar slider. > > Thanks to all. :) > > Willy
|
Pages: 1 Prev: ChangeDisplaySettingsEx Upsupported resolution Next: SetActiveDiscRecorder fails on Vista. |