(To be complete) this is what can be done: CRect rect; m_wndSplitter.GetClientRect(rect); CSize splitter_size = m_wndSplitter.GetSplitterSize(); CSize border_size = m_wndSplitter.GetBorderSize(); int row_height = rect.Height() - ((splitter_size.cy * (m_rows - 1)) + (border_size.cy * 2)); int col_width = rect.Width() - ((splitter_size.cx * (m_cols - 1)) + (border_size.cx * 2)); row_height /= m_rows; col_width /= m_cols; for (int i = 0; i < m_rows; i++) { m_wndSplitter.SetRowInfo(i, row_height, 100); } for (int j = 0; j < m_cols; j++) { m_wndSplitter.SetColumnInfo(j, col_width, 100); } m_wndSplitter.RecalcLayout(); Regards Mahendra
Mahendra_786
Posts
-
Splitter Window -
Splitter WindowThanks. This is probably the only way out. Here is a fragment from Q & A: C++ (Periodicals 1998) from MSDN Library 1999 that does something similar: After calculating the heights of the toolbars, the next troublesome task is calculating the height and width of all the splitter window components: the border with which it surrounds each pane and the splitter bar itself. All these magic numbers are contained within data members in CSplitterWnd, but naturally the data is protected, which means you can’t access it! Sigh. So what do you do? Simple: just derive a new class with public functions to export the protected data, and use it instead of CSplitterWnd in your main frame. class CMySplitterWnd : public CSplitterWnd { public: CSize GetBorderSize() { return CSize(m_cxBorder,m_cyBorder); } CSize GetSplitterSize() { return CSize(m_cxSplitter,m_cySplitter); } };
-
how to convert BYTE to StringTry this: char buff[3] = ""; sprintf(buff, "%X", Byte); // Display in hex (or choose whatever format you prefer) this->Textbox1->Text = buff; Hope it works! Regards Mahendra
-
Splitter WindowI am creating a 2x2 spllitter window in a SDI application. // OnCreateClient of SDI Frame Window ... VERIFY(m_wndSplitter.CreateStatic(this, m_rows, m_cols)); ... I want every pane to be of the same size (plus-minus 1 pixel). In OnSize I do something like: // OnSize of Frame Window ... m_wndSplitter.GetClientRect(rect); int row_height = rect.Height(); int col_width = rect.Width(); row_height /= 2; col_width /= 2; m_wndSplitter.SetRowInfo(0, row_height, 100); m_wndSplitter.SetRowInfo(1, row_height, 100); m_wndSplitter.SetColumnInfo(0, col_width, 100); m_wndSplitter.SetColumnInfo(1, col_width, 100); m_wndSplitter.RecalcLayout(); ... HOWEVER probably due to the "splitting margin" or border between panes, the pane(0, 0) is larger than the other panes with a difference of about 11 pixels in size. Other than "manually" accounting for the border thickness, is there a better way of making the panes same size. Thanks in anticipation.
-
CPtrListBut is this ok - (re)moving from the tail end if a sub-sequence has to be removed and RQUIRES using RemoveAt. This seems to works: for (pos = m_points.GetTailPosition(); !m_points.IsEmpty(); m_points.GetPrev(pos)) { pPt = m_points.GetAt(pos); delete pPt; m_points.RemoveAt(pos); } pos is still not NULL in the end though! Or like in the MSDNL RemoveAt help!: POSITION pos1 = NULL; POSITION pos2 = NULL; for (pos1 = m_points.GetHeadPosition(); (pos2 = pos1) != NULL; ) { m_points.GetNext(pos1); pPt = m_points.GetAt(pos2); delete pPt; m_points.RemoveAt(pos2); } Due Regards Mahendra
-
CPtrListHi, I am trying to iterate and delete the elements (assuming atleast 1 element) in a CptrList with this: void *pPt = NULL; POSITION pos = NULL; for (pos = m_points.GetHeadPosition(); !m_points.IsEmpty(); m_points.GetNext(pos)) { // TRACE("pos: %d, %d\n", pos, NULL); pPt = m_points.GetAt(pos); m_points.RemoveAt(pos); delete pPt; } TRACE shows that pos is not equal to NULL as it should be after the last element has been seen. So pos != NULL check does not work contrary to the MSDN Library documentation. THIS IS ONE PROBLEM. The OTHER is even if there are more than 1 elements the second element returned by GetAt is not "valid" (0xcdcdcdcd) and RemoveAt asserts. Any clues? Regards Mahendra
-
Libraries for creating a RIFF Wav file??Hi, MCI (Media Control Interface) is part of Windows SDK. You may need to work with low-level MCI if you have to directly manipulate raw audio-data. I am not sure if MCI supports MP3 files directly, though. Due Regards Mahnedra
-
wchar_t* wsz = L .. proplem ..If you define _UNICODE the internal CString buffer is already unicode data, which you can get using GetBuffer(). If _UNICODE is not defined, you can convert the buffer using MultiByteToWideChar. Hope this helps! Due Regards Mahendra
-
I need help- After you get the file name from the Dialog create the file using CFile or whatever. 2) In your (added) OnNewDocument function call SetPathName(""); e.g. BOOL CMyDoc::OnNewDocument() { if (!CDocument::OnNewDocument()) return FALSE; // TODO: add reinitialization code here // (SDI documents will reuse this document) SetPathName("c:\\temp\\a.txt"); // c:\temp\a.txt should exist! return TRUE; } This will not display a Save Dialog when you select "Save" from the File menu. If I have not misunderstood your question this should help! Due Regards Mahendra
-
modal dialogWhy would you need to display a modal dialog in OnSize? Due Regards Mahendra
-
Combo Boxes and numbersYou can provide another button to undo the last operation or a "Reset" button to start again. At least it is better than re-starting:) Due Regards Mahendra
-
ISAPI FILTER ON ISA SERVERThats a lot of help to ask for on a Discussion forum. Still I can try, if you care. Due Regards Mahendra
-
Setting Background ColorIn a Win32 application you can set the hbrBackground member of the window class structure typically in "MyRegisterClass". wcex.hbrBackground = CreateSolidBrush(RGB(255, 0, 0)); // This makes the window red In MFC you can do something similar in PreCreateWindow. Due Regards Mahendra
-
How to load DLL from memory, not diskDLLs automatically use shared memory for READ-ONLY areas. Due Regards Mahendra
-
Convert to PDFHi, Yours is a "custom" application which needs to "create/ save as" PDF documents? If that is true than you would need something similar to what you have for RTF; there are commercial libraries available to write PDF files as well. Due Regards Mahendra
-
a question about Edit BoxThat is :rolleyes:HIGHLY:rolleyes: correct and my way in fact may be insufficient not just unnecessary. In fact DDX_* somewhere calls SubclassWindow to do this. Moreover the way I suggested I am not sure how UpdateData will work beside other side-effects. Due Regards Mahendra
-
Convert to PDFHi, It might help if you can give more details. There are "PDF toolkits" available to help create PDF files programmatically but then you will need to "parse" the RTF yourself. Another way is "printing" to something like Adobe's PDFWriter. Regards Mahendra
-
WS_THICKFRAME & Dialog iconJust commenting these 2 lines in OnInitDialog works for me in both vc 6.0 & vc 7.x SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon
-
how to get variable typeWhat vc 7.x is doing seems more logical than vc 6.0 ... it seems to be checking the "from" and "to" types! class A { int a; }; class B: public A { int b; }; /***** break ****/ B b; if (dynamic_cast**(&b)) { printf("OK"); } /***** above will work in vc 7.x but not vc 6.0 */ /***** below will NOT work in both vc 7.x & vc 6.0 */ B b; A *p_a = &b; if (dynamic_cast**(p_a)) { printf("OK"); }****
-
a question about Edit BoxYou can do this using CWnd::SubclassDlgItem Derive your own class say CMyEdit from CEdit and add a WM_CHAR handler: void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { if (nChar >= '0' && nChar <= '9') { CEdit::OnChar(nChar, nRepCnt, nFlags); return; } else { AfxMessageBox("Invalid Key"); } } In your Dialog class add this to OnInitDialog: m_myEdit.SubclassDlgItem(IDC_EDIT1, this); where m_myEdit is a Dialog member of type CMyEdit and IDC_EDIT1 is the edit control id. Hope this helps!