|
What ?
I don't understand a word you wrote ! please, make this more precise, tell us what your real problem is ( in programming category ) , and we'll be glad to help you.
But for now, I don't know where to start !
Max.
|
|
|
|
|
|
Can't believe I'm having so much trouble with this...
I have a dialog box with a combo box that I want to fill with values just prior to creating the modal dialog box. Isn't there an easy way to do this?
Thanks... (feelin pretty dumb)
|
|
|
|
|
i usually put combo box inits in the OnInitDialog function. this gets hit before the dialog is visible, but after all the controls have been created.
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
That's where I'm at, but I can't figure out how to add the strings to the combo box resource created with the dialog editor. I created an array of CStrings that I load after instantiating the dialog box class, but before executing the DoModal function. In OnInitDialog I'm trying to move the CStrings into the combo box, but for an hour now, I'm not having any success.
I suppose I could create the combo box and position it in the dialog in OnInitDialog, but it sure seems like there should be a easier way to do this, using the layout created in the Dialog Editor.
A little more help please!
Thanks.
|
|
|
|
|
first, create a member variable to hold the combo box. use Class Wizard to create a variable of type CComboBox attached to the control ID (call it m_myCombo, or something)
then in OnInitInstance, loop through your array of CStrings, calling m_myCombo.AddString(myString[x]) for each.
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
ClassWizard only allows a CString type as the variable for the combobox ID.
|
|
|
|
|
change the "category" to "Control"
c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
OK, I can fill it now, but when the DoModal returns, how do I get the selected string?
|
|
|
|
|
|
I give up... I Must be in another universe! This example is fine with a modeless dialog, but not a modal dialog. The function GetLBText results in an exception because the dialog window does not exist anymore whan DoModal returns. This should be so simple, but for me, it's a pain in the ...
I'll figure out some other way to implement it.
Thanks anyway, Later.
|
|
|
|
|
work_to_live wrote:
the dialog window does not exist anymore whan DoModal returns
100% correct.
handle OnOK in your dialog, in it, grab the LB value and store it in a member variable. when DoModal returns, grab the value from the member variable.
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
That's close to what I did, and it worked... Seems like a lot of work, but if that what it takes... that's what it takes.
Here's the code that set up the dialog box...
// Iterate through the doc template
POSITION pos=GetFirstDocTemplatePosition();
CDocTemplate *pDocTemplate=GetNextDocTemplate(pos);
pos=pDocTemplate->GetFirstDocPosition();
// Instantiate the Document List dialog class
CdlgDocList SelectDoc;
while(pos)
{
// Get a pointer to the document
CDocument *pDoc=pDocTemplate->GetNextDoc(pos);
// Add the document's name to the Dialog's combobox
SelectDoc.AddString(CString(pDoc->GetTitle()));
}
// Execute the modal dialog box
SelectDoc.DoModal();
// Make a copy of the selected doc name
CString temp=SelectDoc.SelectedString;
The AddString function loaded up a CString array in the dialog class. Then, in the dialog class, I over-road OnInitDialog, and copied the array of CStrings to the ComboBox. Then I over-road DestroyWindow, and prior to destroying the dialog window, I copied the selected string to a public CString of my dialog class. Then as you mentioned, after DoModal returned, I could retrieve the string from that public CString member.
Seems like a lot of work for something so simple!!!!
Thanks for the help.
|
|
|
|
|
First and formost...I hope I don't get chewed out for not posting this in STL/ATL/WTL forum, but I figured this question was suitable for this forum also...
I need a specialized circular queue, so i'll give the requirements and maybe you can tell me if this functionality already exists in STL or something (I don't care for UNDO/REDO systems available on CP, i've buily my own and their to flexible for this purpose )...but I think i'm gonna have to start from scratch...
1) Linear array of bytes(vector???) using new/delete, NOT lists
2) Must be able to specify size(s) MIN and MAX
- Min is the minumum incremental size and starting size of queue (actually it's an item count)
- Max is how large the queue can grow. Each time Min is reached the queue is expanded by Min+=Min
3) Functionality should be similar to a LIFO stack
I figure this would make for an efficient UNDO/REDO system for a fixed data type(Byte's).
I have already implemented something like this before, but didn't include dynamic queue re-allocation. My hopes are that STL has something like this already...?
p.s- I hope I made sense...
[edit]Thinking in C++ says that rings don't exist in STL, so it's safe to assume i'll porlly have to do this myself???[/edit]
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
So you basically want a contiguous byte buffer that can be resized where new blocks bytes get added and removed from the end?
Well, you could use vector. Overkill IMHO. Just resize your allocated undo buffer on the fly. Since the buffer might move in memory, you can't store pointers to objects in the buffer. But you can still reference objects in the buffer by their offset from the start.
Also, don't bother with new/delete. Use malloc/realloc/free (OMG, THEY AREN'T TYPE SAFE, I THINK I AM GOING TO CRY). Then you don't have to worry about creating a new buffer, copying it and the freeing the old. Realloc will take care of that for you.
Sure, it isn't "PC", but screw them. You job is to produce software that works. Not "PC" software that works.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
Also, don't bother with new/delete. Use malloc/realloc/free (OMG, THEY AREN'T TYPE SAFE, I THINK I AM GOING TO CRY). Then you don't have to worry about creating a new buffer, copying it and the freeing the old. Realloc will take care of that for you.
I think I will actually...not only is it faster, but so much easier to implement...
Thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I am trying to get the internal representation of a double in binary... I am attempting this with a union... could any one show me an example of how this can be done... Please no CString methods, I need to do this myself... any leads would be great.
"Best file compression around: DEL *.* = 100% compression."
<><><><><><><><><><><><><>
Matthew R. Miller
mattrmiller@computersmarts.net
www.computersmarts.net
|
|
|
|
|
What about
double var = 1.2;
PBYTE bin=(PBYTE)&var;
for(int i =0; i < 7;i++) {
cout << bin[i] << endl;
}
|
|
|
|
|
what do you mean by "inbternal representation" ?
if you just want the BYTEs, you can do this:
BYTE *p = (BYTE *)&myDouble;
for (int i=0;i < sizeof(double); i++)
TRACE("%c\n", p[i]);
-c
“If it turns out that I’m actually the one who did it, then looking for the real killers would be a big old waste of time.”
-- OJ Simpson
|
|
|
|
|
I have a FrameWnd where I am splitting the the client horizontally. On the right hand side I would like to split it vertically (similar to outlook). The right hand side is a class called CCourseView. When CCourseView::Create is called I try to create another splitter for within that class. Unfortunately I get an error stating "Failed to create an empty document".
<br />
BOOL CCourseView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) <br />
{<br />
if (!m_wndSplitter.CreateStatic(this, 2, 1))<br />
{<br />
TRACE0("Failed to create splitter window\n");<br />
return FALSE;<br />
}<br />
<br />
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CHoleView),<br />
CSize(0, 90), pContext))<br />
{<br />
TRACE0("Failed to create COutlookPanel\n"); <br />
return FALSE;<br />
} <br />
<br />
if (!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CHoleStatsView),<br />
CSize(0, 150), pContext))<br />
{<br />
TRACE0("Failed to create CCourseView\n"); <br />
return FALSE;<br />
} <br />
<br />
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);<br />
}<br />
Any Ideas?
Sincerly,
Clint Singer
|
|
|
|
|
I do all splitting in my CMDIChildWnd (for you it would be your CFrameWnd ) derivative and only after I have successfully CreateStatic ed all of my splitters I begin creating the views, all in my overridden OnCreateClient().
This way it works for me.
|
|
|
|
|
Hi.
I implemented a CFormView. I would like to know how do you set the minimum size of the window?
For example, I override OnSize() and add a breakpoint to see if Windows calls that function as I resize the frame. Windows does call OnSize. However, I cannot find a way to limit resize to above a certain size. Right now, the user can resize the frame anyway imaginable include minimizing it to the point where all there is left is the caption bar.
Thanks,
Kuphryn
|
|
|
|
|
Follow these two steps:- In the
OnInitialUpdate of your view, add this by the end of the method:
GetParentFrame()->RecalcLayout();
ResizeParentToFit(FALSE);
- Set the syle of your
CFrameWnd -derived window to non-resizable (play with border styles till you get it) and override PreCreateWindow like this:
BOOL CYourMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style&=~WS_SIZEBOX&~WS_MAXIMIZEBOX;
return CFrameWnd::PreCreateWindow(cs);
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
i have another question.
i develop my application in the 1024*768,the formview has not scrollbar.
when i change to 640*480 or 800*600, the scrollbar show.
would you like tell me any good method?
|
|
|
|
|
Check out WM_GETMINMAXINFO
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|