|
Hi,
I'm trying to change some controls size of my dialog when I maximize/minimize it. But I don't know which are exactly the steps I must do to change those controls width and heigth!! It's not difficult but I can't manage myself!!
Thanks in advance,
Edgar
|
|
|
|
|
You could use the method SetWindowPos
Call this member function to change the size, position, and Z-order of child, pop-up, and top-level windows.
BOOL SetWindowPos(
const CWnd* pWndInsertAfter,
int x,
int y,
int cx,
int cy,
UINT nFlags
);
Probably you'll have to obtain a pointer to the control with
GetDlgItem()
The GetDlgItem function retrieves a handle to a control in the specified dialog box.
HWND GetDlgItem(
HWND hDlg, // handle to dialog box
int nIDDlgItem // control identifier
);
Hope this helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Use SetWindowsPlacement....
Regards...
Carlos Antollini.
Sonork ID 100.10529 cantollini
Computer analyst to programmer: "You start coding. I'll go find out what they want."
|
|
|
|
|
There is a very nice and easy-to-use class on CP.
/moliate
|
|
|
|
|
Incredible! how many simple and powerfull!!!
Thanks a lot!
|
|
|
|
|
I want to be able to tell the visual studio editor (VC++ specifically) to open a file and move to a specific line, from and external (not and add-in or macro) MFC program.
Can anyone suggest somewhere to find examples on how to do this... (I've looked in MSDN but it seems to be only concerned with VB, Add-ins and macros).
Thanks...
Blade[DMS]
|
|
|
|
|
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
|
|
|
|