|
the menu item is only visible when you display the menu, and this is when the ON_UPDATE_COMMAND_UI.
if you have toolbars with the same ID, the ON_UPDATE_COMMAND_UI will be called eventually, and the button will be enable ( or disable ) at that time.
in your "other" function, you will need to set a class variable that will indicate if the menu ( or toolbar item ) will be enable or not; and processed in the ON_UPDATE_COMMAND_UI handler.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
i am in a project and i would like to save the attributes from an xml file in another file.in that xml file we have results from some texts and we need to analyze them by a program in c++DOM but i need to save only one type of nodes and its attributes.If someone can show me an example of a program that make similar things i would thank him.
Thank you very much
one new student in c++
|
|
|
|
|
|
Hi to all,
I would like to create a CEDit derived class with the following caratteristic:
Every time the user digits a char in the edit box, the class should control
the value of that char and compare it with a defined list of allowed chars
If the char doesn't match the list, char should not be accepted and a MessageBeep should be prompt
Anyone can help me?
Thanks in advance
|
|
|
|
|
Insert New Class
give new name for class and derived it from CEdit by selecting it from combobox.
And write your validation code in OnChar() ( u have to add this fucntion thru class wizard WM_CHAR )
Jetli
Constant Thing In World Is Change.
|
|
|
|
|
Hi,
It is quite simpe to do: with Class Wizard, create your own class (call it CMyEdit for example) and make it inherits from CEdit. Then override the OnChar method (not 100% sure about the function name but I think this is good). In this function, compare the char entered with those in your list. If it is not allowed, don't call OnChar from the parent (CEdit::OnChar() ). Otherwise call it and it will add the char in the edit box.
You will probably need to add a function to send your list to the class also. Call this function in the initalisation of your dialog box that contains your edit control.
Now, to add your specific control, use the resource editor and paste a standard edit, and with class wizard, you will have the possibility to choose your class to be associated with the control.
That's it
Hope this helps
|
|
|
|
|
Thanks to the users who replied me
You're so great!
|
|
|
|
|
Just a heads up, if you do your verification in OnChar your users will be able to enter invalid characters via copy 'n paste. You are much better off handling the verification in the OnUpdate (EN_UPDATE) handler. Check out the edit controls section here on CP for validating edit controls for sample code.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
I want to add a button on windows Save As dialogue tool bar. I need information (name, path) about current document (which send Save As dialogue). From any documents I want to save them automatically in a fixed folder(s).
Best regards,
Mihai
mihai_chioariu
|
|
|
|
|
I have custom draw a dialog as my app's main dialog. I also want my dialog support resizing, so I choose the resizing style in resource editor. And in order to hide the ugly resizing border, I also draw the resizing border by my own. But when my app lost it foucs, the ugly resizing border also appear!!
I also override the OnNcPaint, but seems useless.
So would any one give any advice? any comment is appreciate!
Thanks a lot. pls, now I really do not know how to do.
|
|
|
|
|
How to retrive the key state of modifier keys combined with an other key like Tab.
For example .. to retrieve Alt+Tab keystate. ie. Alt-press +Tab press + Tab release + Alt release ??
Are there any ways...
Plz let me know
Thank you
vidhya
|
|
|
|
|
GetAsyncKeyState Function
The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.
|
|
|
|
|
Hi, I need to upload TEXT files to an IIS server(ASP.NET, c#) from my MFC code. I also will be writting that code to accept the files at the server end. Can some one suggest how I can go ahead and upload files to the server.
Mayank Goyal
|
|
|
|
|
|
Well I do not have the option of using ftp as it is blocked I need to do it with HTTP only.
Mayank Goyal
|
|
|
|
|
|
Hello
I have a MDI application. Usely the user can open more then one document (CDocument) at the same time. Now I will open just one document at the same time. How can I block to open a secound document?
thanks for help Ernst
|
|
|
|
|
Are you wanting your MDI application to behave like an SDI application?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello David
I will no change to a SDI. I will just open one document (with the same template class) at the same time.
regards Ernst
|
|
|
|
|
Rather than allowing the user to select a second file only to tell them it is not possible, why not just disable the File/Open menu option altogether when a file/document is open?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
This would be a possibility. But not for every case. Becaus I have enabled the user to do "file drag" into the application. So the user don't need the open button to open a document. Do you know a way where I can check all opened document before a new document is create?
Ernst
|
|
|
|
|
senn wrote:
Do you know a way where I can check all opened document before a new document is create?
Try the OpenDocumentFile() method.
Another option would be to close the opened file before attempting to open another.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello David
:-DGreat! The OpenDocumentFile() is the right member function. It's allways called when I open a document. So I can manage the functionality in this function.
Thanks a lot!
Ernst
|
|
|
|
|
i need to invoke a jvm, but i don't know why FindClass() returns 0.
i think it's about class.path settings or the name of the class i'm trying to access.
what do i have to put in class.path? the path of my java class or the path of jdk?
do java class and .exe have to be in the same directory?
help me please, thanks!!
here is my code:
// ============= java class ============ //
package embedding;
// ...
public static void main(String[] args)
{
MyClass prova = new MyClass();
prova.run();
}
// ============= c++ code ============ //
//...
options[0].optionString = "-Djava.class.path=C:\\aa\\MyClass"; // the directory path where my java class is saved
//...
//cls = env->FindClass("C:/aa/MyClass");
cls = env->FindClass("MyClass");
|
|
|
|
|
hii...i am transferrin the resources from one exe to another....
also i am saving the resources as a .rc using the Resource Hacker software...which replaces the existing .rc file of the project.....
but i am getting the following error:-
"error RC 2019 : expected preprocessor command, found '1' "
(the error gigving line is-- #106 MENU)
this one is due to the id of the MENU resource i hav trasnferred from another exe
the next error is:- "RC Terminating after preprocessor errors"
how can i solve this?
is ther another way pf updating the .rc or .res files of a projetc using VC++ programming ?
regards,
kedar.
|
|
|
|