|
You've probably figured it out by now, but...
I think what you want to do is disable the controls that can't be updated. You should be able to use EnableWindow(false) function to disable the controls dynamically. The OS should exlude disabled controls from the tab order automatically. I assume it works in the embedded environment as well - give it a shot.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Hi, Steve.
That is exactly what I was looking for. Thanks very much for your assistance.
|
|
|
|
|
I'm sure there is a simple solution to my problem but I'm just not seeing it. I'm trying to update my views as I read data from a file. I have implemented a separate thread so that the program is able to respond to other command while it is reading. Because of this I cannot use UpdateAllViews() . I tried using events, which worked, but with some undesired side effects. The next approach would be to post a message and have the views update on this. So far I have in my CDocument:
::PostMessage(HWND_BROADCAST, UWM_UPDATE_VIEW, 0, 0);
And in the CView I have:
BEGIN_MESSAGE_MAP(CAESView, CView)<br />
ON_REGISTERED_MESSAGE(UWM_UPDATE_VIEW, Update)<br />
END_MESSAGE_MAP()<br />
<br />
LRESULT CAESView::Update(WPARAM wParam, LPARAM lParam)<br />
{<br />
return 0;<br />
}
The code compiles and runs but my CView never responds to the message. Am I missing something?
Thanks.
|
|
|
|
|
Hi, I'm not sure about UWM_UPDATE_VIEW message and how MFC handles it but PostMessage with HWND_BROADCAST sends the message to all top-level windows and a CView usually is a child windows of a frame.
The main window should capture your registered message and make the view updates.
Best regards,
Mauro.
|
|
|
|
|
If you do some reading about how CCmdTarget dispatches messages to the MFC framework I bet you find that it does not support HWND_BROADCAST. You will have to handle that in a parent location like your CFrameWnd class and provide child notification yourself.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
|
Hi, I'm a student playing around with c++ windows forms in .net 2003. That said, I have a quick question. I can't seem to access the data my iterator is pointing at. All the examples of iterators I can find show that I am doing it right. Is there something with windows forms that changes things?
The Code:
typedef std::vector<int> StatsVector;
//create a vector to hold the random numbers
StatsVector stats;
StatsVector::iterator statIter;
statIter = stats.begin();
int tempStat = 0;
//populate the vector with 6 random integers
for(int i = 0; i < 6; i++)
{
stats.push_back(randomNum());
}
//display the results in the designated text box
tempStat = *statIter;
str->Text = tempStat.ToString("G");
statIter++;
tempStat = *statIter;
dex->Text = tempStat.ToString("G");
statIter++;
tempStat = *statIter;
con->Text = tempStat.ToString("G");
statIter++;
tempStat = *statIter;
intel->Text = tempStat.ToString("G");
statIter++;
tempStat = *statIter;
wis->Text = tempStat.ToString("G");
statIter++;
tempStat = *statIter;
chr->Text = tempStat.ToString("G");
//this is how it worked without iterators randomNum returns an int
//str->Text = randomNum().ToString("G");
If anyone wants the project files to compile them, I can email them to you.
If you know of a good book that covers all these vc++ windows forms then please post it.
Thanks,
Matt
|
|
|
|
|
Not sure but try getting the iterator after you load the vector
statIter = stats.begin();
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Thank You, That fixed it.
Now I feel kinda stupid, at least I won't forget how to use iterators in this way... I hope.
Matt
|
|
|
|
|
Hi again
In windef.h we can see these defines :
#define LOBYTE(w) ((BYTE)((DWORD_PTR)(w) & 0xff))
#define HIBYTE(w) ((BYTE)((DWORD_PTR)(w) >> 8))
I don't understand how HIBYTE gets, most significant byte, by above code.
With LOBYTE all is clear.
I thought these macros were getting bytes from 32 bit value.
It found out they are for 16 bit values, now all is clear
thanks.
-- modified at 14:36 Friday 19th May, 2006
|
|
|
|
|
HI all
I have CDerivedStatic class and method :
void CDerivedStatic::foo()
{
...
SetDlgItemText( ,
"Some text" );
...
}
I know I can call the SetWindowText API, but I need this variant
thank you.
-- modified at 13:26 Friday 19th May, 2006
|
|
|
|
|
It's the ID of the objects that you defined in the resource editor.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
This will work fine:
void CDerivedStatic::foo()
{
SetWindowText("Some text");
}
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
|
I know Ican call SetWindowText API, but I need to get ID of current instance ?
thank you.
|
|
|
|
|
|
|
Hello all,
I am trying to create a custom control but I have a major problem I haven't been able to resolve. The issue is this: If I introduce a customer control using the resource editor to a new or an existing dialog box, that specific dialog will cease to appear when the program is run (or the app won't run if it happens to be within the main dialog box). If I delete the control, everything works fine again and the dialog box will once again appear.
Could someone please assist? This has been puzzling me for quite some time. I'm using VC++ 2005. To replicate, create a new dialog based application. Run it to see the default dialog box appear, then exit. Drag a custom control from the toolbox into the main dialog box. Run it again. If you can get the dialog box to appear even if the control doesn't do anything yet, let me know what you did!
Thanks!!!!!
|
|
|
|
|
You have to provide a window class name that has been registered (through AfxRegisterClass function). Take a look at this article[^] for an example.
If you don't follow this step, there won't be any window procedure associated with the control and the creation of the dialog will fail.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Can you add the DS_NOFAILCREATE style (until you resolve the problem)?
Do you get any output in the debug window (e.g, failed to load xyz.dll)?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hey i have faced the same problem and got the solution over this.
univega_r304 wrote: If I delete the control, everything works fine again and the dialog box will once again appear.
Call the Following Method to enable the custom containers in the application where you are using the custom controls
AfxEnableControlContainer();
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
How do I get user input from a toolbar embedded in a CMDIFrameWnd, to a control in a Cdialog called by a CView?
Ideally, I would like to open the dialog modal, then take the mouse out of the dialog to click on a button in the toolbar, thereby updating a control in the dialog according to which button was clicked on the toolbar.
I presume I need to make the dialog modeless, then somehow disable all other windows except the toolbar. Is that the best way, and if so can you please point me to ways to do that? Otherwise, can I somehow activate the toolbar from the modal dialog when the mouse gets over the toolbar, or gets clicked in the toolbar?
Thanks, Chris.
|
|
|
|
|
Hi Chris,
U can get the parent window from dialog and convert into appropriate class and get tool bar -> get the status . or else
declare a pointer in the mainframe class to ur dialog . send notification any changes in the Tool bar event.
|
|
|
|
|
Thankyou Kiran
But I remain confused! Currently, ny dialog is modal, so as I understand it, when it is open, the toolbar will not get any messages. I am happy to make the dialog modeless, but if I do, how do I fake modal behaviour? I can see how to disable the parent window, but I want the toolbar to be able to get mouse clicks so I can use it to enter data into the dialog. Thanks, Chris.
|
|
|
|
|
I have a problem where my toolbars automatically get stacked on top of each other on the upper left side of my app.
These are the steps that cause the problem:
1. User starts analysis process with toolbars set to his/her liking
2. Analysis process runs with modeless progress dialog (counter)
3. User minimizes app window before analysis ends
4. Analysis runs to completion while app window is minimized
5. User restores app window - toolbars show up stacked on the upper left side
The problem does not occur if the app window is restored before the end of the analysis. It also does not occur if the app window is in the background of another window (instead of minimized). So it only occurs when the analysis completion & progress dialog termination occur while minimized.
Any help is greatly appreciated. Thanks,
Victor
|
|
|
|