|
In the dialog box, there are 3 edit boxes. After the dialog box initialized, the first edit box is highlighted and also have focus. What I want to do is when the first edit box is not empty, set it as ready only and also set the focus to the second dialog box.
I tried
GetDlgItem(IDC_EDIT2)->SetFocus(); Not working
Also tried
CEdit *pEdit =(CEdit*)GetDlgItem(IDC_EDIT2);
pEdit->SetFocus();
still not working.
Please help me with this problem.
|
|
|
|
|
You can get into race conditions using SetFocus() in a dialog. Use PostMessage( WM_SETFOCUS,.. ) instead.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
This is the way:
In menu "Layout",you may find "Tab Order"! click it and the dialog edit will show 1,2,3,4.....,that is the focus order,change the order by click controls,you can set the focus to the second dialog ,good luck !
sorry for my language!
|
|
|
|
|
I am experiencing a very strange problem.
When my MFC app is run, all of the Tool Tips in our program, as well as all Windows Tool Tips show the tip of the *last* tool that was hovered over. Here is what happens upon program launch.
* The first toolbar button that I hover over doesn't get drawn. Actually, it's shadow gets drawn, but the tip itself doesn't draw.
* The next toolbar button that I hover over gets drawn with the text of the first button that I hovered over.
* The width of the Tool Tip is wide enough for the text of the "correct" text, not the width of the "incorrect" text which is being displayed.
* This goes on and on until you hover off of a button onto some dead space, and then hover over it again, in which case, it will show the correct tip, but goes wacky again once you hover over another button.
* All Tool Tips on the system get screwed up like this until the app is shut down.
Thus, there seems to be a "lag" or mismatch bewteen what is being displayed and what the correct tip should be.
To try and get to the bottom of this problem, I have commented out all Tool Tip related code from my app, including Tool Tip flags passed to controls such as Tree controls, etc.
I have also tried commenting out any other "non-standard" things that I am doing. All of my users are experiencing this. I have tried creating a new blank app using AppWizard, but could not duplicate the problem.
Does anyone know what this might be related to, or what I might have done wrong to screw things up? If not, does anyone have any info on how to debug something like this, or where I can even trace/step through the code to find out what is going wrong and where.
Thanks
Dario
|
|
|
|
|
How can I display text next to the toolbar button when the mouse is on top of it? By default, text entered at the Prompt field is displayed at the Status bar. It is not user-friendly since the user will have to look at the buttom of the screen to see the text.
Eilzabeth
|
|
|
|
|
I just figured it out myself. At the Prompt field of the Toolbar resouce editor, I added the string "\n", for example, "System Users\nUsers".
Eilzabeth
|
|
|
|
|
Some body please help me to make a 3 bitmap button on a dialog box
buttons like A,b,C ...if 'A' is pressed from key board
button A will be depressed, if 'b' is depressed from key
board, button b will be depressed.
Can any one do it and help me! really ??
|
|
|
|
|
You can find out how to make the three buttons with bitmaps on them here on the code project. The MSDN library also has information on this topic. Once you are done with the buttons, you should have a function associated with each button.
From there you have to listen for keyboard events. Should a key you are interested in be pressed, you just call the function for the proper button you want to press.
Lorenz Prem
Microsoft Corporation
|
|
|
|
|
I have problem with CTime in DoDataExchange() function
None of 15 overrides in funkcion takes CTime as an parameter
When I convert it using CTime aTime.Format("%d.%m.%Y") then
I'm able to transfer data from ODBC database into my Edit control
but when I try to Update database then it throws exception.
Can somebody help me with right way of doing this.
Thank You
|
|
|
|
|
i have none about direct-x or open-gl.
my Q is: could any of them capture screen (or any window)?
if so, i will learn.
thx for any suggestions.
includeh10
|
|
|
|
|
To clarify your question: Are you trying to create an app that captures standard Windows desktop windows or specifically a DirectX/OpenGL app?
- Mike
|
|
|
|
|
use directx or open-gl to capture screen or windows, normal method is too slow.
includeh10
|
|
|
|
|
Hi,
I would like to be able to send a file (.doc) throught internet with a client/server App. I will probably use MFC & CSocket to code the App.
Microsoft documentation tell us that we can send ordinary data (int, double, CString , serializable class etc..) using serialization into CSocket. But what if I want to send a file unstead of data.
Is there a way to achieve this?
thanks a lot
Mykel
Everything's beautiful if you look at it long enough...
|
|
|
|
|
an easy way would be to read the contents of a file into a buffer and then send the buffer over the net. If the files are big, you can read the files in chunks - and send each chunk over the net and reassemble them on the other side.
--
Ich, du, sie, er, es, ihr, sie, Sie.
|
|
|
|
|
Check out MSDN for Simple MAPI, or you could use PJ Naughter's CSMTPConnection which here on CP. Do a search.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
if I use this code, it doesn't select the item on which I rt-clciked, rather selects the item next to it.
Please help.
void CMfcTree::OnRclickTree1(NMHDR* pNMHDR, LRESULT* pResult)
{
//
CPoint pt;
GetCursorPos(&pt);
ScreenToClient(&pt);
HTREEITEM hItemHit=m_nTree.HitTest(pt);
if(hItemHit)
m_nTree.SelectItem(hItemHit);
*pResult = 0;
AfxMessageBox(m_nTree.GetItemText(m_nTree.GetSelectedItem()));
}
Please correct this code.
Thanks
Binayak Bhattacharyya
|
|
|
|
|
First, you need to do the ScreenToClient(&pt); in the context of the tree control, not the dialog: m_nTree.ScreenToClient(&pt); .
Second, you need to call HitTest() like this:
UINT uFlags = 0;
HTREEITEM hItemHit = HitTest(pt, &uFlags);
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
That solved the problem.
Thanks tons
|
|
|
|
|
Well, i'm giving up on a project i was supposed to do in LabView (graphical programming) and i'm doing it in good 'ole MFC. I need to know what i should use for a certain display of data. My assumption is a progress control, but there may be something better.
Here is what i want it to look like, roughly: clicky[^]
I'm more interested in the red slider bar than anything. I need a red one and a black one, and i haven't figured out how to change the colors of progress controls in MFC as of yet. Is there an alternative, or should i use the progress control?
*.*
cin >> knowledge;
|
|
|
|
|
Naw, don't use a progress control for something like this - it's far too bloated for what you need. Just draw a simple client-edge static control with some tick marks (if fixed, this is even easier). Then treat the value as a percentage and draw a red or black rectangle in the client edge (taking into account the client edge) that is the same height (or width) of the static control and the percentage of the width (or height) of the static control. This is simple enough and easier to customize (more than likely) than a pre-canned CProgressCtrl class in MFC.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
*jump* *jump*
well, i thought jumping might help me catch the stuff flying over my head. if i understand you corrrectly, you suggested making a static control (like a static text?) and draw a rectangle inside it? Thats a great idea, but what type of static control do i use? :-/
*.*
cin >> knowledge;
|
|
|
|
|
Just a regular static text control??
I think a slider control may be what you want.
John
|
|
|
|
|
No, not even that. You have the overhead of the slider control while trying to override its painting (i.e., owner drawing) anyway. It's pointless.
By static control, I meant CStatic (since you're using MFC). It's a simple control with no frills. You're thinking of the CEdit control (to the original poster). You could even derive from CWnd - you just need a surface to paint on. This is a very simple solution and trying to "extend" some existing control that is "close but no cigar" will just make things worse.
Consider using a slider: sure, it has tick marks - but you don't want the actual slider, right? So you have to go to all the work of either keeping the slider from painting or painting over it. After that, you have to go to the trouble of still painting your simple colored rectangle.
So, just make your own control (say, CGuage that derives, preferrably, from CWnd ) and handle the WM_PAINT message (or use a number of overridables or other forms for owner drawing).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
Consider using a slider: sure, it has tick marks - but you don't want the actual slider, right? So you have to go to all the work of either keeping the slider from painting or painting over it. After that, you have to go to the trouble of still painting your simple colored rectangle.
Yes you do want the slider. You want a disabled range selection slider but without a thumb. But I just look at the code that I was thinking about and it was a complete owner draw (basically a copy of the MFC control with a few modifications) so I guess there is no point to using a slider. I had to use an owner draw slider on a mammography system because the thumb rect was too small on the high resolution monitors (2K by 2.5K resolution).
John
|
|
|
|
|
i think using a progress control qwould be easiest, and i found out how to use SetBkColor. I need to change the slider color tho, not the background color. can this be done? msdn isn't helping much...
*.*
cin >> knowledge;
|
|
|
|