Slider toolbar application Summary

Source: Internet
Author: User

1. How to Control slider:

Applications can call the slider control member function to retrieve information about the slider control and change its features.

To retrieve the slider position (that is, the value selected by the user), use the (getpos member function. To set the slider position, use
Setpos member functions. Can be used at any time
Verifypos member function to ensure that the slider is between the minimum and maximum values.

The range of the slider control is the continuous value set that the slider control can represent. After the first slider control is created, most applications use
The setrange member function sets the range of the slider control. In use
After the setrangemax and setrangemin member functions create a slider control, the application can dynamically change the slider control range. Applications that allow dynamic range changes generally retrieve the final range setting after the user finishes processing the slider control. To retrieve these settings, use
Getrange, getrangemax, and
Getrangemin member function.

 

 

         m_SliderA.SetRange(0, 255);m_SliderB.SetRange(0,255);m_nPosA = 120;m_nPosB=255;UpdateData(FALSE);

 

2. How to respond to slider changes:

The slider control is sent to the parent windowWm_hscrollOrWm_vscrollMessage (depending on the slider control), notifies the parent window of user operations. To process these messages
Wm_hscrollAndWm_vscrollAdd the message handler to the parent window. Forward
The onhscroll and onvscroll member functions pass the notification code, the slider position, and the point
Csliderctrl object pointer. Note that the pointer type isCscrollbar *, Even if it points
CsliderctrlObject. To operate the slider control, you may need to convert the pointer type.

The slider control does not use the scroll bar notification code, but sends different notification code sets. The slider control is sent only when you use the keyboard to interact with the slider control.
Tb_bottom,Tb_linedown,Tb_lineupAnd
Tb_topNotification code. The message is sent only when the user uses the mouse.Tb_thumbpositionAnd
Tb_thumbtrack
Notification message. Send in both casesTb_endtrack,Tb_pagedownAnd
Tb_pageupNotification code.

The following table lists the slider control notification messages and events that result in notification sending (Virtual key code and mouse events ). (For a list of standard false key codes, see winuser. H .)

Notification Message Events that cause notification sending
Tb_bottom Vk_end
Tb_endtrack Wm_keyup(The user released the key for sending the related virtual key code)
Tb_linedown Vk_rightOrVk_down
Tb_lineup Vk_leftOrVk_up
Tb_pagedown Vk_next(The user clicks the Channel below the slider or on the right)
Tb_pageup Vk_prior(The user clicked the channel above the slider or on the left)
Tb_thumbposition Wm_lbuttonupInTb_thumbtrackAfter notification message
Tb_thumbtrack Slider Movement (the user dragged the slider)
Tb_top Vk_home
Example:

Void cthresholddlg: onhscroll (uint nsbcode, uint NPOs, cscrollbar * pscrollbar) {updatedata (true );

If (pscrollbar = getdlgitem (idc_slidera) // obtain the slider pointer; m_na = m_nposa; // change the value of edit box A; else m_nb = m_nposb; // change the value of Box B. // refresh (); updatedata (false); refresh ();

Cdialog: onhscroll (nsbcode, NPOs, pscrollbar );}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.