|
Yesterday I asked question about how can use "Anchor property" in MFC,some guyes tell me
about some articles (3 articles) in CP.I checked them,all of them are for VC6 and
all of them have some problems in VS.NET .Is there any other way for using Anchor propert?
Or is there anybody use those articles in VS.NET?Maybe I made mistake somewhere?
I used these articles:
ResizableLib By Paolo Messina
Layout Manager for Dialogs, Formviews, DialogBars and PropertyPages By Erwin Tratar
ResizableFormView By Paolo Messina
Any suggestion would be appreciataed.
thanx
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I have an MDI app that has multiple document templates. I create a pointer to each and then when I want to activate a Doc/View I use:
theApp.m_ptSCR->OpenDocumentFile(NULL);
This works perfectly for the default behavior of the views, but I need to be able to pass arguments to have a different behavior occur in the OnInitialUpdate function in my view classes. How do I get the parameters passed through to the view?
Ed
|
|
|
|
|
Probably the easiest way is to store additional information in your app object before calling OpenDocumentFile. View could access this using AfxGetApp (with proper static_cast) during OnInitialUpdate.
Other possible location for this sort of data is static member of CYourView.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I am still somewhat new to this so bear with me.
In my main app I declare some variables as static, then in my view I can use AfxGetApp() to get a pointer to the main app and access the variables. Correct? This will work perfectly but the static_cast is the part I don't have a good handle on. What would the code be in my view to access a variable declared in my main app as
static CString m_sMessage;
Thanks so much for your help.
Ed
|
|
|
|
|
(Just an approach among others, by no way standard technique) Add some variables to your CDocTemplate -derived class to hold this initialization params. Set them before the call to OpenDocumentFile . In OnInitialUpdate , the view is already attached to the document, so by static_cast<CMyDocTemplate *>(GetDocument()->GetDocTemplate()) you get access to the params.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
If I do it this way, how do I add variables to CMultiDocTemplate? It doesn't give me the option to derive from it.
Ed
|
|
|
|
|
Why can't you derive from CMultiDocTemplate ? If the MFC wizard does not give you the option (is this the problem?) you can always create a derived class manually. Later, substitute CMyMultiDocTemplate (or whatever) for all occurrences of CMultiDocTemplate in your code.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I ran into something similar recently. Notice that OpenDocumentFile return a pointer to the CDocument it just created. You can use it to notify the view.
CMyDoc *pDoc = m_pDocTemplate->OpenDocumentFile(NULL);
pDoc->SetValues(...);
pDoc->UpdateAllViews(NULL, WM_DONE_SOMETHING); In view code...
void CMyView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
if(lHint == WM_DONE_SOMETHING)
{
CMyDoc* pDoc = GetDocument();
.
.
}
} Hope this helps.
P.S. Look at CDocument::UpdateAllViews. There is a third CObject parameter you can use...
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
I have a simple SDI app with a CFormView-based view. However, this gives a border around the app that makes the menu and status bar appear 'above' the actual view itself.
Unfortunately my client would rather the all appeared on the same level, I guess like a dialog-based app.
Any ideas how I can do this?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Please see this thread where Paolo Messina struggles his way to the solution.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Joaquín M López Muñoz wrote:
Please see this thread where Paolo Messina struggles his way to the solution
Wow! Do you actually book mark all interesting threads?
Nish
[Signature temporarily down]
|
|
|
|
|
Whenever I found such a gadget and use it in one of my programs, I add a little comment with the place I extracted it from for later reference. It is easier to remember where I used such and such trick rather than the URL itself.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
o.k. so say i have data like:
DataString = "2432382ab" or "238233923829cd" or "23882323rq"
and I want to extract the two rightmost elements (say the letters above) in VB I would do:
theLeft = right(DataString,2)
in C++ ?
string theLeft
theLeft = DataString.substr(-2,2);
someone told me i could do this, but I can't get it to work . . .
thanks if you can help!
tim
---------------------------------------
Tim Booher
|
|
|
|
|
CString s="hello world";
CString s2=s.Right(2);
Nish
[Signature temporarily down]
|
|
|
|
|
If you're using std::string s the way to go is DataString.substr(DataString.size()-2) .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
yeah -- that is exactly what i needed . . . thanks . .. tim
---------------------------------------
Tim Booher
|
|
|
|
|
Some time ago I wrote the code for own control delived from CWnd. The class is using the code for drawing color edge (for redrawing standart windows client edge). This code is correct but it blink. :
void CWnd::OnNCPaint(){
CWnd::OnNCPaint(); // this line I have only for drawing scrollbars because i dont know how to draw it myself. If you call this function, Windows will draw standart client edge and the control (nonclient area) blink !!
CWindowDC dc(this);
CRect rect;
GetWindowRect(&rect);
dc.Draw3dRect(0,0,rect.Width(),rect.Height(),RGB(255,0,0),RGB(0,0,255));
}
I showed in MSDN but i dont find anything
if you call this :
CScrollBar * scrollbar = GetScrollBarCtrl(SB_VERT);
scrollbar->Invalidate();
it will be assert because scrollbar is not valid window (ASSERT(::IsWindow(m_hWnd)))
Thanks very much !!!!!!!
Wiizi
|
|
|
|
|
I haven't worked out this idea, but maybe it is of some help. In your preliminary solution, instead of calling CWnd::OnNCPaint issue a call to the default window proc like this:
DefWindowProc(WM_NCPAINT,(WPARAM)hRgn,0); hRgn is a region that indicates the clipping area for doing nc painting. Maybe you can create a rectangular region that excludes the border to avoid the flickering.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Good morning everyone. Here's today question.
I have an SDI with the view spilt into 3 columns using CSplitterWnd. I'm trying to set the width of the 1st and 3rd columns to specific widths. Is there a way to explicitly set the width of the 3rd column to a fixed width? I've tried to set width of the 3rd column using
m_wndSplit.SetColumnInfo(2, 3RD_COL_WIDTH, 3RD_COL_WIDTH)
but it just sets the width to whatever is leftover from columns 1 and 2.
Do I have to just get the desired widths of 1 and 3 and set 2 to the remainding width? If so, could someone send me a snippit on the best way to do this. I'm still getting used to proper windows size management.
Thanks in advance.
Marcus
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|
|
I have a Word document.I want to input this document to a
database.Generally,i will create a table in a database,then input a
column ,then input next column. In order to save my time,now i want to
input the whole Word document by a program.
please tell me some English information about this.Or tell me web
sites.Thank you!
huang chun shen
|
|
|
|
|
I reply you once,did you see that?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Some time ago I wrote the code for own control delived from CWnd. The class is using the code for drawing color edge (for redrawing standart windows client edge). This code is correct but it blink. :
void CWnd::OnNCPaint(){
CWnd::OnNCPaint(); // this line I have only for drawing scrollbars because i dont know how to draw it myself. If you call this function, Windows will draw standart client edge and the control (nonclient area) blink !!
CWindowDC dc(this);
CRect rect;
GetWindowRect(&rect);
dc.Draw3dRect(0,0,rect.Width(),rect.Height(),RGB(255,0,0),RGB(0,0,255));
}
I showed in MSDN but i dont find anything
if you call this :
CScrollBar * scrollbar = GetScrollBarCtrl(SB_VERT);
scrollbar->Invalidate();
it will be assert because scrollbar is not valid window (ASSERT(::IsWindow(m_hWnd)))
Thanks very much !!!!!!!
Wiizi
|
|
|
|
|
|
I used the rand() function the other day.
From the MSDN it says:
The rand function returns a pseudorandom integer in the range 0 to RAND_MAX. Use the srand function to seed the pseudorandom-number generator before calling rand.
1. Seed the generator with srand()
2. Generate a random number with rand()
3. Divide the generated number by RAND_MAX.
4. Multiply the result 9 and add 1
This will give you a number between 1 and 10
I think this is right.
Marcus
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|