|
I have a point in one of my classes where I need to send the users focus to the next field in the tab order, is there a way I can throw a <tab> keypress, or a way to set focus to the next field in the tab order?
thanks for any suggestions
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
NextDlgCtrl();
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks for the quick responce i was using a CFormView, and it wouldn't let me use it, but i realized my problem was that i was creating my edit fields with WS_READONLY instead of WS_DISABLED.. my program was stopping at uneditable fields and i didnt want it to, didnt realize it was cause it wasnt disabled
ill keep this answer in mind tho, im sure ill need it sooner or later
thanks again!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hello,
I've searched but have been able to come up with anything on this, so any input would be appreciated
The problem:
When my process is taking care of some lengthy processing, the Applications tab of the Windows Task Manager reports it as "Not Responding", when in reality it is just busy working hard. The problem is that most users confuse this by stating "The process is hung" and try to kill it, etc. They don't realize that ( NotResponding != Dead ) which is probably not their fault, but M$'s for choosing such a term to "label" a busy process.
My question:
Is there any way to programatically control what is displayed here? Or, what would probably be a better solution, send "I'm still alive and working" type messages to the Windows Task Manager so that it doesn't report the process as Not Responding?
Thanks!
--
Edward Livingston
(aka ExtraLean)
--
"I still maintain that seeing a nipple is far less disturbing than seeing someone get their brains blown out." -- Chris Maunder
|
|
|
|
|
The process is too busy in it's main thread for it's message loop to respond to windows. You need to do this work in a worker thread.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi Christian, long time we didn't fight for a question
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
*grin* I must admit I'd never seen your solution before. Will it make the UI responsive, or only *seem* responsive ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
It'll only fool the Task Manager into thinking the app is responsive, but this is what the guy asked for.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That's fair enough, I was only curious for myself because I'd not seen it before at all, so I wanted to know for my own reference.
Thanks
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Try inserting
MSG msg;
PeekMessage(&msg,NULL,0,0,PM_NOREMOVE); every so often within your lengthy processing.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The problem is that your "lengthy processing" is taking more than 5 seconds to complete, and during this time, it does not have a chance to process windows messages. The windows task manager will wait five sconds before deciding that a windows task is "dead", and will show the task as "not responding" as long as this condition is true.
Here's the code I use:
MSG msg;
if (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
I usually put this into a "while" or "do" loop when I'm waiting for another flag to be set to allow processing to continue.
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
I renamed the OK button : ID_FAKEOK and changed its tab order. Then my modeless dlg didnt vanish when I hit ok. BUT.....I dont want this button at all!!!! So when I deleted it, now the modeless dlg vanishes again when I hit enter.....
I plan to send and receive lots of messages in this CDialog so I think I cant pre-translatemessage it.
How shall I correct my enter-key response?
Appreciate your help,
ns
|
|
|
|
|
Try overriding OnOK with a do-nothing function.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That did it!!!! Many thanks!
Appreciate your help,
ns
|
|
|
|
|
Hi,
I need some serious help setting a font in a CFormView (with an embedded CListCtrl)class. The on initial update code looks like this...
void CTextWindow::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
//size the window to the proper side that would fit the parent
CFrameWnd *pParentFrame = GetParentFrame();
pParentFrame->RecalcLayout();
ResizeParentToFit(TRUE);
//displays the window text depending on the template used to
//create an instance of this class.
if(GetDocument()->GetDocTemplate() == theApp.pOutputDocTemplate)
pParentFrame->SetWindowText("Output Window");
else
pParentFrame->SetWindowText("");
//intialize the font to be used with a constant font
font.CreateFont(14,0,0,0,0,0,0,0,0,0,0,0, FIXED_PITCH | FF_MODERN, "Courier New");
//delete all entries from the list control
m_List.DeleteAllItems();
//set up list control to contain one column
m_List.InsertColumn(0,"Text",LVCFMT_LEFT, 1600, -1);
//set a font of the list control
m_List.SetFont(&font,FALSE);
//set a boolean flag to false to indicate that no file has been loaded yet.
fFileLoaded = false;
}
Pay attention to the lines....
//intialize the font to be used with a constant font
font.CreateFont(14,0,0,0,0,0,0,0,0,0,0,0, FIXED_PITCH | FF_MODERN, "Courier New");
m_List.SetFont(&font,FALSE);
I'm trying to implement font control in this program after the initial update, but I also want to set the font before this window is created. So I'm having a lot of trouble.
I try to make a member function that looks like this.
void CTextWindow::SetScreenFont (...)
{
//same font object as before
font.CreateFont (//parameters);
m_List.SetFont (&font, FALSE);
}
I do this and I get Debug Assertion errors in the Debug configuration and crashes in the Release! Can anyone tell me how to remedy this problem and get a working font control algorithm?
Thanks,
Mike Mathers
|
|
|
|
|
Hi All,
I'm running VS 6.0, and I have created and SDI application using multiple splitter windows to display different aspects of stuff. In each of the splitter frames I have a CFormView derived class that handles the specifics of each view.
My problem is that when the main application gets resized or the splitters get resized, I need to be able to resize the dialog in each of the panes to the size of the pane. I don't have a clue how to do this. It seems I am only able to display the size of the orginal resource for that ID. Any ideas on how to do this??
Any help or suggestions or even just a general direction are greatly appreciated. Thank you.
Dan Willis
|
|
|
|
|
Use SetWindowPos , but be warned this will merely resize the dialog, yet the controls will stay in their original positions. If you want full control over how the dialog is to be laid out under size changes, check Erwin Tratar's Layout Manager for Dialogs, Formviews, DialogBars and PropertyPages[^]
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Actually, I believe that will work. LOL I knew there was a function out there, just couldn't think of the name of it.
I'm actually running a dll that takes the size of the window and makes all the on-screen adjustments, so all of the layout managing is already done. I think that will take care of it. Gotta run some tests to make sure. There's always a small catch. lol.
thanks! I'll keep ya posted.
Dan Willis
|
|
|
|
|
I have a dialog resource IDD_A, and need to "plug in" a new and improved IDD_A (Basically my existing IDD_A crashes the code when I add a third party ACtiveX control on it. However if I put that control on a CDialog BEFORE the other controls, then it doesnt crash. Now what I dont want to do is insert a new Dialog which has a different name IDD_B because Class WIzard will create a new class for it, and I'll have to go through the old class and put in stuff into the new class, and also replace the old class everywhere it occurs in my View class.....not pretty. I tried tricking VS by renaming the old dialog and calling the new dlg IDD_A. I also went and commented out stuff in the resource file. But when I go to give my new dialog dlg the name IDD_A it says that this is associated with IDD_AOLD (which is what I renamed the old dialog). NOw I dont see any place (searched) thaT I could do anything that will make my new CDialog get associated with the same class.
Help?
Appreciate your help,
ns
|
|
|
|
|
search for the line
enum { IDD = IDD_AOLD };
replace with
enum { IDD = IDD_ANEW};
|
|
|
|
|
OOps! I did what you said and it crashed....am going to see if I can see why...
|
|
|
|
|
Create the new dialog resource, give it the same name IDD_A and set the condition _NEW_INTERFACE_ (in the Properties dialog on the left panel), or whatever name you please. Then, by setting/resetting _NEW_INTERFACE_ in Project->Settings->Resources->Preprocessor definitions your program will use one or another dialog resource.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm using VS6. What properties window is this you mention?
Appreciate your help,
ns
|
|
|
|
|
Go to ResourceView on the left panel: there's a tree listing all resources you have included, right-click on that corresponding to the new dialog resource and select Properties.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I just got your response. In the meantime, I created my new dialog, and when I did ctrl W it said its a new dialog - cretae a new class or choose existing<. When i chose existing, it said okay I'm going to replace your old IDD_A with the new one IDD_B. And it did what it promised.....so I've pasted your resolution in m y hints.doc for the future.
Appreciate your help,
ns
|
|
|
|
|