Click here to Skip to main content
15,886,823 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CEdit extended Pin
Jochen Arndt9-Oct-12 4:22
professionalJochen Arndt9-Oct-12 4:22 
QuestionMagnified Window Pin
john56329-Oct-12 1:02
john56329-Oct-12 1:02 
AnswerRe: Magnified Window Pin
chaau10-Oct-12 1:05
chaau10-Oct-12 1:05 
QuestionVS2010 Release Build Prob Pin
002comp8-Oct-12 22:09
002comp8-Oct-12 22:09 
AnswerRe: VS2010 Release Build Prob Pin
Richard MacCutchan8-Oct-12 22:19
mveRichard MacCutchan8-Oct-12 22:19 
AnswerRe: VS2010 Release Build Prob Pin
Sivaraman Dhamodharan8-Oct-12 22:42
Sivaraman Dhamodharan8-Oct-12 22:42 
GeneralRe: VS2010 Release Build Prob Pin
002comp10-Oct-12 0:07
002comp10-Oct-12 0:07 
QuestionSending iterator items to other functions from in a for block.... Pin
Ben Aldhouse8-Oct-12 21:32
Ben Aldhouse8-Oct-12 21:32 
Here is some code from the draw function in my custom control. I am using a vector to contain data concerning portions of the control.

This code works. You will surely agree with me, though, that using the iterator 'x' to identify vector members in called functions is probably a tad on the clunky side. I have had a go at sending pointers to vector members. I gave up with this. I think this might not be the right way to go either. What it is the correct, elegant way to do this?


C++
vector<sliderUnit>::iterator slider;
for ( slider=sliderVector.begin() ; slider != sliderVector.end(); slider++ )
{

    theSliderRect.left = theDrawRect.left+(x-2)*sliderWidth;
    theSliderRect.right = theSliderRect.left + sliderWidth;

    (*slider).m_TextBoxSize = m_TextBoxSize;
    (*slider).sliderRect = (RECT)theSliderRect;

    tempRect=theSliderRect;
    tempRect.right=tempRect.right-4;

    DrawBackground(&theMemDC,tempRect);

    if (m_currentSlider != x-1){
        (*slider).m_bFlashFocus = FALSE;
    }
    else{
        (*slider).m_bFlashFocus = TRUE;
    }

    DrawButtonsByID(&theMemDC, theSliderRect, x-1);
    DrawThumbSliderByID(&theMemDC, theSliderRect, x-1);
    DrawSliderLabelByID(&theMemDC, theSliderRect, x-1);
    x++;
}


modified 9-Oct-12 16:11pm.

QuestionRe: Sending iterator items to other functions from in a for block.... Pin
Maximilien9-Oct-12 3:53
Maximilien9-Oct-12 3:53 
AnswerRe: Sending iterator items to other functions from in a for block.... Pin
Ben Aldhouse9-Oct-12 10:16
Ben Aldhouse9-Oct-12 10:16 
GeneralRe: Sending iterator items to other functions from in a for block.... Pin
Stefan_Lang15-Oct-12 22:33
Stefan_Lang15-Oct-12 22:33 
GeneralRe: Sending iterator items to other functions from in a for block.... Pin
Ben Aldhouse16-Oct-12 21:35
Ben Aldhouse16-Oct-12 21:35 
GeneralRe: Sending iterator items to other functions from in a for block.... Pin
Stefan_Lang16-Oct-12 22:20
Stefan_Lang16-Oct-12 22:20 
GeneralRe: Sending iterator items to other functions from in a for block.... Pin
Ben Aldhouse18-Oct-12 9:16
Ben Aldhouse18-Oct-12 9:16 
GeneralRe: Sending iterator items to other functions from in a for block.... Pin
Ben Aldhouse12-Nov-12 21:47
Ben Aldhouse12-Nov-12 21:47 
GeneralRe: Sending iterator items to other functions from in a for block.... Pin
Stefan_Lang12-Nov-12 22:38
Stefan_Lang12-Nov-12 22:38 
Questionhelp Pin
thebebo188-Oct-12 11:12
thebebo188-Oct-12 11:12 
JokeRe: help Pin
Peter_in_27808-Oct-12 13:22
professionalPeter_in_27808-Oct-12 13:22 
GeneralRe: help Pin
Sivaraman Dhamodharan8-Oct-12 20:44
Sivaraman Dhamodharan8-Oct-12 20:44 
Questionsetup error Pin
emanalshboul8-Oct-12 9:58
emanalshboul8-Oct-12 9:58 
QuestionRe: setup error Pin
David Crow8-Oct-12 10:32
David Crow8-Oct-12 10:32 
AnswerRe: setup error Pin
Richard MacCutchan8-Oct-12 22:16
mveRichard MacCutchan8-Oct-12 22:16 
QuestionCustomize CFileDialog? Pin
bosfan8-Oct-12 5:05
bosfan8-Oct-12 5:05 
AnswerRe: Customize CFileDialog? Pin
jeron18-Oct-12 5:52
jeron18-Oct-12 5:52 
GeneralRe: Customize CFileDialog? Pin
bosfan8-Oct-12 21:37
bosfan8-Oct-12 21:37 

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.