Click here to Skip to main content
15,892,674 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can we create Unlimited number of controls at runtime? Pin
Niklas L20-Aug-10 2:02
Niklas L20-Aug-10 2:02 
AnswerRe: How can we create Unlimited number of controls at runtime? Pin
Niklas L19-Aug-10 22:07
Niklas L19-Aug-10 22:07 
QuestionNM_EVENT is not being called Pin
learningvisualc19-Aug-10 20:23
learningvisualc19-Aug-10 20:23 
QuestionSocket based application and Anti-viruses Pin
rahul.kulshreshtha19-Aug-10 19:59
rahul.kulshreshtha19-Aug-10 19:59 
AnswerRe: Socket based application and Anti-viruses Pin
Richard MacCutchan19-Aug-10 22:41
mveRichard MacCutchan19-Aug-10 22:41 
AnswerRe: Socket based application and Anti-viruses Pin
Moak20-Aug-10 2:37
Moak20-Aug-10 2:37 
AnswerRe: Socket based application and Anti-viruses Pin
CPallini20-Aug-10 3:05
mveCPallini20-Aug-10 3:05 
QuestionComBoBox:SetCurSel & GetCurSel() Pin
Anu_Bala19-Aug-10 18:14
Anu_Bala19-Aug-10 18:14 
Hi,

In my dialog,I have combobox which contains the status of Switch(On & OFF).
By checking the status of switch,i have to display On or Off in top.
Ex: if Switch1 status is OFF,then the combox shows OFF in top.THen user can change the postion or status of Switch1 by choosing in combobox dropdown.
I havae code like.
a)OnInitDialog()
for(int i=0;i<nState;i++)   //nState-number of Position or Status
{
CString ton = ((CTagSwitch *)oTagBase)->GetCaption(i);   //ton contains ON ,OFF
m_cOP.InsertString(i,ton);   //Combo box have index0-ON,index1-OFF
}

b)OnPaint()
if(oTagBase->GetSwStatus()==0)  //Switch1 in OFF status				
  m_cOP.SetCurSel(1);		
else				//On Status
  m_cOP.SetCurSel(0);


c)OnCbnSelchangeStatecombo() //User change the positon of switch

int nIndex =m_cOP.GetCurSel();
switch(nIndex)
	{
		case 0 :  // Off
		sConfirmMsg="COnfirm to change postion to OFF ?"
		break;
		case 1 :  // On
		sConfirmMsg="COnfirm to change postion to ON?";  
		break;
	}


My problem is,
To change the postion of Switch1,when i dropdown the combobox and click ON,the selection(blue color) is on OFF only(because inOnPaint() im setting SetCurSel(1))
After selecting in OnCbnSelChange() it always show the index what i set in OnPaint() not retriving the index of what im selected.

Whats the mistake.Pls help me.
Anu

AnswerRe: ComBoBox:SetCurSel & GetCurSel() Pin
Cool_Dev19-Aug-10 19:28
Cool_Dev19-Aug-10 19:28 
GeneralRe: ComBoBox:SetCurSel & GetCurSel() Pin
Anu_Bala19-Aug-10 19:31
Anu_Bala19-Aug-10 19:31 
GeneralRe: ComBoBox:SetCurSel & GetCurSel() Pin
Cool_Dev19-Aug-10 20:14
Cool_Dev19-Aug-10 20:14 
GeneralRe: ComBoBox:SetCurSel & GetCurSel() Pin
Anu_Bala19-Aug-10 19:45
Anu_Bala19-Aug-10 19:45 
AnswerRe: ComBoBox:SetCurSel & GetCurSel() Pin
David Crow20-Aug-10 3:07
David Crow20-Aug-10 3:07 
QuestionRetrieve TreeView Selected Item Pin
Fareed Rizkalla19-Aug-10 9:55
Fareed Rizkalla19-Aug-10 9:55 
AnswerRe: Retrieve TreeView Selected Item Pin
Niklas L19-Aug-10 10:15
Niklas L19-Aug-10 10:15 
GeneralRe: Retrieve TreeView Selected Item Pin
Fareed Rizkalla19-Aug-10 11:47
Fareed Rizkalla19-Aug-10 11:47 
GeneralRe: Retrieve TreeView Selected Item Pin
Niklas L19-Aug-10 11:53
Niklas L19-Aug-10 11:53 
GeneralRe: Retrieve TreeView Selected Item Pin
Fareed Rizkalla19-Aug-10 12:21
Fareed Rizkalla19-Aug-10 12:21 
GeneralRe: Retrieve TreeView Selected Item Pin
Niklas L19-Aug-10 19:40
Niklas L19-Aug-10 19:40 
AnswerRe: Retrieve TreeView Selected Item Pin
rahul.kulshreshtha19-Aug-10 20:03
rahul.kulshreshtha19-Aug-10 20:03 
QuestionClean/Hide/Invisible Form while running Pin
mohit`1219-Aug-10 8:58
mohit`1219-Aug-10 8:58 
QuestionRe: Clean/Hide/Invisible Form while running Pin
Maximilien19-Aug-10 9:59
Maximilien19-Aug-10 9:59 
AnswerRe: Clean/Hide/Invisible Form while running Pin
mohit`1220-Aug-10 3:36
mohit`1220-Aug-10 3:36 
AnswerRe: Clean/Hide/Invisible Form while running Pin
rahul.kulshreshtha19-Aug-10 20:13
rahul.kulshreshtha19-Aug-10 20:13 
GeneralRe: Clean/Hide/Invisible Form while running Pin
mohit`1220-Aug-10 3:38
mohit`1220-Aug-10 3:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.