|
Hello,
Does anyone know a few tricks to make Edit controls behave like "smart labels"? That is; I want them to be read-only, but not have a caret. It's nice being able to copy the text using Ctrl+C, something which a simple static control cannot offer.
I assume there is a simple subclassing trick you can do. If you know it, feel free to tell me.
--
Behold, for I am THE CORRUPTOR!
|
|
|
|
|
What about the other way round, implement copy operation on a CStatic ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
How do you select text in a static?
--
Behold, for I am THE CORRUPTOR!
|
|
|
|
|
Hi,
I have a give a CString value from one class to Editcontrol of another class.
Example- In GrpView.cpp,
CString Strnum = "123";
I have to put this value in Dialog.cpp ,in Edit control of that particular dialog.
Can we do this like this,Is there any way?Pls help me
Anu
|
|
|
|
|
hi,
In the CDialog Class Declare a CString Variable and also in the View Class when you populate the CDialog Class.
CView Class
CDialogInstance dlg;
dlg.strNameValue = strViewClassString;
dlg.DoModel();
Good Luck.
Uday kiran
|
|
|
|
|
Do your dialogs have a parent child relationship.
If affirmative you can use
GetParent();
else
you will need to pass a pointer of your class in another class and after that you can start using the variable/s / data of one class from another.
eg :
CMyDialog *myDlg=new CMyDialog();
myDlg->m_pParent=this;
myDlg->DoModal();
and in the header file of the child include the dialogs header file(for calling class.)and declare CMyFirstDialog m_pParent;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
See here if its good for you
<br />
(1)<br />
CDialogyour dlg;<br />
dlg.strNameValue = String;<br />
dlg.DoModel();<br />
-------------------<br />
(2)
CMain* m_Main=(CMain*)GetParent();<br />
m_Main->values or functions<br />
-------------------<br />
(3)<br />
CMain *m_Main;<br />
m_Main=new CMain();<br />
m_Main.Create(...);
m_Main.yourvariable=Values;<br />
--------------------<br />
|
|
|
|
|
Thanks but its not fulfil my need..I have a seperate keyboard other than our system keyboard.
I have class for that as keyboard.cpp,if i press 1 in that keyboard it goes to WM_KEYDOWn in that class and it goes to OnKEyDown in that particular CView class which one is active,but the number should typed in Edit control of dialog which is invoked by clicking the view window.
The WM_KEYDOWn function only goes to avtive View CGrpView and not to that particular dialog.So,i thought to get that all values which are entered in seperate keyboard in to CString and then give this CString value to Edit control..
My Objective is : when i pressed 1 in seperate keyboard it should get entered in that edit box in the dialog..
Anu
|
|
|
|
|
I have problems following you, but maybe what you need is something completly different and is more along the lines of a "focus follows mouse" setting for the whole Windows-Gui?
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
You want when you click 1 it insert to edit and run wm_keydwon,right?
|
|
|
|
|
Yes, when i clicked 1 it goes to keyboard.cpp,ther i wrote
void CKBoard::OnLButtonUp(UINT nFlags, CPoint point)
{
case 51 :
ActiveView->PostMessage(WM_KEYDOWN,49,0); break;
}
It executes the line and then it goes to OnkeyDown() in that particular dialog,their i wrote..
void CFaceDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
case 49:
case 97:
sSktNumValue += "1";
break;
}
This is coding..when i debugged this coding the control after executing WM_KEYDOWN...It should go to Onkeydown() in that dialog..But the control goes to OnKEyDown() in te particular view where the dialog exist...So i wrote the codings of Dialog OnKeyDown() in to THat view class OnKeyDown() function.
Thats im asking is there anyway to get value which i pressed in keyboard go to dialog OnKeyDown or the control goes as it is View class OnKeyDown()but the final value should entered in that particular Dialog edit box...
Pls give any solution..
Anu
|
|
|
|
|
WM_CHAR isnt good for you
|
|
|
|
|
Hello! I am new to c++.
I am now trying to create a GUI based program using Microsoft Visual C++ 2005 Express Edition.
I have a question. I want that when I click the exit button, the whole program that I created will exit. Can anybody tell me how to do that?
|
|
|
|
|
Try ::PostQuitMessage(0); .
|
|
|
|
|
Robert Edward Caldecott wrote: ForumVisual C++ / MFC
Subject:Re: Exit the program.
Sender:Robert Edward Caldecott
Date:6:22 8 Aug '06
Try ::PostQuitMessage(0);.
Thanks for your reply. But, your code doesn't work.
|
|
|
|
|
|
|
See SendMessage(WM_CLOSE);
|
|
|
|
|
what type of application is urs?
I mean Dialog base or sdi etc?
nave
|
|
|
|
|
Hi,
if CForm View then Use ::PostQuitMessage(0);
if Dialog then use ::OnOK().
Good Luck.
Uday kiran
|
|
|
|
|
Hi,
I have included
using std namespace;
#include "vector.h"
in C++ compiler. The same file i'm opened in MSVC and compiled it ends with following error
error C2871: 'std' : does not exist or is not a namespace
fatal error C1083: Cannot open include file: 'vector.h': No such file or directory.
Just quick will do be great...
Rgds
vivek.s
|
|
|
|
|
vivek.s.vivek wrote: using std namespace;
Should be
using namespace std;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
actually tried with using namespace std; (I have mistakenly specified in
the previous message). still showing an error
error C2871: 'std' : does not exist or is not a namespace
You only have to do a very few things right in your life so long as you don't do too many things wrong.
Vivek.S
|
|
|
|
|
vivek.s.vivek wrote: 'std' : does not exist or is not a namespace
Try doing this way :
#include "vector"
#include "iostream"
using namespace std;
What is the type of application and your IDE?
-- modified at 5:35 Tuesday 8th August, 2006
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
It is #include <vector> without the .h.
And you need to put the using std namespace; line after the include.
-- modified at 5:22 Tuesday 8th August, 2006
Oops, sorry, I read the line too fast. Of course, it is using namespace std;
|
|
|
|