Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » the selection area of a slider of a status bar can not be displayed Collapse All
Subject Author Date
George Zhou Nov 16, 2004 - 7:22 PM

I created a project as follows:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

<o:p> </o:p>


1. Click “new project”, select “ProfUISAppWizard”, type in name “test”, click “OK” button.<o:p></o:p>


2. Select “Multiple Documents”, “Use MFC in a static library” “ Use ProfUIS in a static library” and click “Finish” button.<o:p></o:p>


3. copy the following codes into mainfrm.h:<o:p></o:p>


      class CExtStatusBarSliderCtrl : public CSliderCtrl{<o:p></o:p>


            virtual void PostNcDestroy(){<o:p></o:p>


                  delete this;<o:p></o:p>


            }<o:p></o:p>


      };<o:p></o:p>


4. Add the following codes into CMainFrame<o:p></o:p>


      CExtStatusBarSliderCtrl *m_pWndSliderCtrl;<o:p></o:p>


5. Add the following codes into CMainFrame::OnCreate<o:p></o:p>


                  m_pWndSliderCtrl = new CExtStatusBarSliderCtrl;<o:p></o:p>


                  if (!m_pWndSliderCtrl->Create(<o:p></o:p>


                        TBS_NOTICKS|WS_CHILD|WS_VISIBLE|WS_TABSTOP|TBS_HORZ|TBS_ENABLESELRANGE, <o:p></o:p>


                        CRect(0,0,0,0), <o:p></o:p>


                        &m_wndStatusBar, <o:p></o:p>


                        0))<o:p></o:p>


                  {<o:p></o:p>


                        TRACE(_T("Failed to create slider control.\n"));<o:p></o:p>


                        return -1;<o:p></o:p>


                  }<o:p></o:p>


                  <o:p></o:p>


                  bool bRet = m_wndStatusBar.AddPane(11,1);<o:p></o:p>


                  if(!bRet){<o:p></o:p>


                        AfxMessageBox(_T("Pane index out of range\nor pane with same ID already exists in the status bar"), MB_ICONERROR);<o:p></o:p>


                        return -1;<o:p></o:p>


                  }<o:p></o:p>


                  <o:p></o:p>


                  int nIndex = m_wndStatusBar.CommandToIndex(11);<o:p></o:p>


                  if (nIndex == -1)<o:p></o:p>


                        return -1;<o:p></o:p>


                  <o:p></o:p>


                  m_wndStatusBar.SetPaneWidth(nIndex, 80);<o:p></o:p>


                  m_wndStatusBar.SetPaneControl(m_pWndSliderCtrl, 11, true);<o:p></o:p>


<o:p> </o:p>


                  m_pWndSliderCtrl->SetRange(0,100);<o:p></o:p>


                  m_pWndSliderCtrl->SetSelection(10,60);<o:p></o:p>


6. Compile, link and run.<o:p></o:p>


<o:p> </o:p>


Now we can see a slider shown on the right side of the status bar, but it does not show any selection area, although “m_pWndSliderCtrl->SetSelection(10,60)” was executed. <o:p></o:p>


<o:p> </o:p>


I found your example “StatusPanes” can show the selection area of the status bar. Could you please let me know how to implement it. Thanks for your help!<o:p></o:p>


<o:p> </o:p>


BTW: I am using windowxp, visual studio .net 7.0 and Prof UIS 2.24.<o:p></o:p>

Technical Support Nov 17, 2004 - 3:28 AM

We created a slider bar in the status pane as you described. In some cases, the selection range is really hidden but we think that the problem lies somewhere with CSliderCtrl. Please try to increase the height of the status bar:

m_wndStatusBar.GetStatusBarCtrl().SetMinHeight(28);
That should help.