List 2.0 checkbox and togglebutton
-
Have revisited a C++ program i wrote about 6 years ago. It used the THREED vbx controls. Am now using Visual C++ 6.0 and i can not develop with them as they need a licence. Originally got them from buying the SAMS Visual C++ 1.5 book and CD. Anyway, i decided to replace them with an ocx that is more available. When i did an 'insert activex control', the Microsoft Forms 2.0 controls were available. Had no probs replacing my command buttons and frames but the check boxes have been a nightmare. Then i thought the toggle button might look better and tried it. Still a nightmare. Where my problem lies is in seeing the state of the checkbox and/or toggle button. Thought the following line would differentiate between depressed and not depressed: if (m_ToggleButton1Control.GetValue == false) However, it always returns true. i use other properties that work: {m_ToggleButton1Control.SetForeColor(olive_note);} The 'value' is defined as a VARIANT of which i can not find any documentation. Can anyone help??? benny
-
Have revisited a C++ program i wrote about 6 years ago. It used the THREED vbx controls. Am now using Visual C++ 6.0 and i can not develop with them as they need a licence. Originally got them from buying the SAMS Visual C++ 1.5 book and CD. Anyway, i decided to replace them with an ocx that is more available. When i did an 'insert activex control', the Microsoft Forms 2.0 controls were available. Had no probs replacing my command buttons and frames but the check boxes have been a nightmare. Then i thought the toggle button might look better and tried it. Still a nightmare. Where my problem lies is in seeing the state of the checkbox and/or toggle button. Thought the following line would differentiate between depressed and not depressed: if (m_ToggleButton1Control.GetValue == false) However, it always returns true. i use other properties that work: {m_ToggleButton1Control.SetForeColor(olive_note);} The 'value' is defined as a VARIANT of which i can not find any documentation. Can anyone help??? benny
-
bennyrascal wrote: if (m_ToggleButton1Control.GetValue == false) Should work, if
m_ToggleButton1Control
is of typebool
(or evenBOOL
), and if you usedUpdateData
(or corresponding message) with parameter TRUE. ~RaGE();Thanks Can't use true as i get a compiler error: D:\Development\C++\Source\CheckBoxes\CheckBoxesDlg.cpp(195) : warning C4805: '==' : unsafe mix of type 'struct tagVARIANT (__thiscall CMdcToggleButton::*)(void)' and type 'const bool' in operation When using the class wizard to add a member variable the only choice i have is a category of control and a variable type of CMdcToggleButton. There are no other choices. If i use the standard checkBox then i get the categories of control and of value and the value bit works. As far as the updatedata, Here is the actual code: void CCheckBoxesDlg::OnClickToggleButton1() { UpdateData(TRUE); m_ToggleButton1Control.UpdateData(TRUE); m_ToggleButton1Control.GetValue(); if (m_ToggleButton1Control.GetValue == false) {m_ToggleButton1Control.SetForeColor(olive_note);} else {m_ToggleButton1Control.SetForeColor(red_note);} } As you can see i even did the update two different ways as an experiment. A similar function for a simple checkbox works perfectly: void CCheckBoxesDlg::OnClickFormsCheckBox1() { UpdateData(TRUE); if (m_FormsCheckBox1Control.GetValue == 0) { m_CommandButtonControl.SetForeColor(blue_note); m_CommandButtonControl.SetCaption("FormsCheckBox set on"); m_FormsCheckBox1Control.SetBackColor(blue_note); } else { m_CommandButtonControl.SetForeColor(yellow_note); m_CommandButtonControl.SetCaption("FormsCheckBox set off"); m_FormsCheckBox1Control.SetBackColor(yellow_note); } } Again thanks for any help as i'm baffled. benny