Click here to Skip to main content
15,904,652 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Richard MacCutchan11-Jan-16 21:23
mveRichard MacCutchan11-Jan-16 21:23 
AnswerRe: MFC, Cannot disable Menu option from Child View Pin
Jochen Arndt11-Jan-16 21:30
professionalJochen Arndt11-Jan-16 21:30 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Member 1120327712-Jan-16 3:51
Member 1120327712-Jan-16 3:51 
QuestionHow to change a alignment of CStatic Label at run time? Pin
Le@rner9-Jan-16 1:52
Le@rner9-Jan-16 1:52 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan9-Jan-16 2:46
mveRichard MacCutchan9-Jan-16 2:46 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner10-Jan-16 18:29
Le@rner10-Jan-16 18:29 
QuestionRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan10-Jan-16 20:56
mveRichard MacCutchan10-Jan-16 20:56 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner12-Jan-16 18:23
Le@rner12-Jan-16 18:23 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan12-Jan-16 21:20
mveRichard MacCutchan12-Jan-16 21:20 
QuestionHow to determine whether the disk is bitlocker? Pin
AnsiliWork8-Jan-16 19:29
AnsiliWork8-Jan-16 19:29 
AnswerRe: How to determine whether the disk is bitlocker? Pin
Richard MacCutchan8-Jan-16 22:51
mveRichard MacCutchan8-Jan-16 22:51 
QuestionObject Data lost when dialog is moved 'off screen Pin
Member 122530108-Jan-16 12:24
Member 122530108-Jan-16 12:24 
AnswerRe: Object Data lost when dialog is moved 'off screen Pin
Richard Andrew x648-Jan-16 15:34
professionalRichard Andrew x648-Jan-16 15:34 
GeneralRe: Object Data lost when dialog is moved 'off screen Pin
Member 1225301011-Jan-16 5:45
Member 1225301011-Jan-16 5:45 
QuestionHow to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork7-Jan-16 14:55
AnsiliWork7-Jan-16 14:55 
SuggestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
Richard MacCutchan7-Jan-16 22:08
mveRichard MacCutchan7-Jan-16 22:08 
GeneralRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 19:32
AnsiliWork8-Jan-16 19:32 
QuestionRe: How to analyze what time Windows 7(XP) once run any program? Pin
David Crow8-Jan-16 11:56
David Crow8-Jan-16 11:56 
AnswerRe: How to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork8-Jan-16 20:31
AnsiliWork8-Jan-16 20:31 
QuestionStrange CListBox Behavior Pin
wdolson7-Jan-16 14:44
wdolson7-Jan-16 14:44 
I have a bizarre problem with a dialog. I created a dialog to move items between two lists. The left list box has the pool of possible items that are unused on the left and the items being used on the right. In between the two are a bunch of buttons to move selected items left or right, or move the entire list from one box to the other.

The boxes are defined as:
C++
CListBox m_lstLeft;
CListBox m_lstRight;

In the .RC file the boxes are defined as follows:

C++
LISTBOX         IDC_LSEL_LSTLEFT,7,25,115,186,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LISTBOX         IDC_LSEL_LSTRIGHT,178,25,115,186,LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP

The code for loading and handling the boxes is the same with just the names of the boxes changed. For example the move right button handling code extracts an item from the left box and puts in the the right and the move left button does the opposite.

Moving an item from the left box to the right works as expected. The code to get the item from the left box is:

C++
CArray<int,int> aryListBoxSel;
aryListBoxSel.SetSize(nCount);
m_lstLeft.GetSelItems(nCount, aryListBoxSel.GetData());
for(i=0; i<nCount; i++)
{
    idx = aryListBoxSel.GetAt(i);
    val = (float)m_lstLeft.GetItemData(idx);
    // does stuff with val here
}

If idx 2, the third item in the list ends up in val as expected.

However, moving from right to left, using a mirror image of the same code:

C++
idx = aryListBoxSel.GetAt(i);
val = (float)m_lstRight.GetItemData(idx);

val is always the last item in the list, no matter what idx is.

I compared the code and everything is a mirror image of the other. The two lists are defined the same way, loaded the same way, and accessed the same way.

What could possibly be wrong? As far as I can tell, I am setting up two identical list boxes and getting two different results.

modified 8-Jan-16 4:01am.

GeneralRe: Strange CListBox Behavior Pin
Richard MacCutchan7-Jan-16 22:07
mveRichard MacCutchan7-Jan-16 22:07 
GeneralRe: Strange CListBox Behavior Pin
Jochen Arndt7-Jan-16 22:18
professionalJochen Arndt7-Jan-16 22:18 
SuggestionRe: Strange CListBox Behavior Pin
Jochen Arndt7-Jan-16 22:17
professionalJochen Arndt7-Jan-16 22:17 
GeneralRe: Strange CListBox Behavior Pin
wdolson7-Jan-16 22:42
wdolson7-Jan-16 22:42 
GeneralRe: Strange CListBox Behavior Pin
Richard MacCutchan7-Jan-16 22:51
mveRichard MacCutchan7-Jan-16 22:51 

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.