You could overwrite the OnChange Handler (I think it was EN_CHANGED or something like that) and manually get the text, check for any non-digit and remove it. Then set the corrected Text with SetWindowText(), or ReplaceSel().
There are however several pitfalls you need to avoid. First, setting the text programmatically also calls the event handler, and you need some status variable to prevent "recursive" calls.
Second, You need to take the cursor position into account. When you call SetWindowText(), usually the whole edit control content is selected. You could set the cursor position to the end with SetSel() (IIRC you need two calls, one to mark everything and at the same time set the cursor to the end, a second one to mark nothing and leave the cursor where it is.) Since the user may have entered something in the middle you may want to get the cursor position before changing anything (with GetSel()) and set it back to that position later.
I usually avoided these issues by letting the user enter the wrong values and checking them when the control lost focus, unless where was a strong argument against this approach.
I'm not sure where should I post this but it's part of the code in Clips (C Language Integrated Production System ) environment which is software tool for building expert systems.
please let me know where should I post it?
You've been told that this forum isn't suitable, yet have decided to post here again. No matter how may times you post CLIPS != c || c++, the c=part denotes it can be integrated with c-based systems. Additionally CLIPS is relatively specialised, rule based programming is different to the way c operates.
All this adds up to one thing: the advice I have seen here so far is spot-on: don't post this here as this isn't the correct forum and few people here will have an interest in CLIPS, your chances will be vastly improved by posting on a specialised CLIPS forum where everyone is there as they know about/are interested in it.
The defrule for Rule0 has an unbalanced number of brackets BTW my guess is there is one missing at the end of the "not" line, and the ? after tank-is-full looks suspicious. Of course I know next to nothing about CLIPS, which is why going to a CLIPS forum would be so handy.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
yeah, I do that but I didn't get any answer so I post here.
yours help a lot because every time I check every thing else rather than brackets. I didn't pay attention to that at all, it was just frustrating to check sth again and again and don't know what to do.
my problems solved, THX
A couple of weeks ago, I got this nasty rash on my mouse clicking finger. I posted a question to a medical site but nobody answered. I figured that since I was writing a C++ program when it started to hurt that I would repost my question here.
hello everybody :
i want to ask i recently downloaded a C++ source code , i just want to make program executable ( i mean make it binaries)like linux ,
is there any free program that do and make the setup file .
Thanks anyway .
You need to create a project, add the source files to it, compile it and fix the compiler type errors if any.
After this process, you will have an executable.
As for creating a setup program, you can use the free Wix Toolset.
It will integrate with Visual Studio so that you can create the setup program from Visual Studio itself.
You can download it from here - http://wixtoolset.org/[^]
Here is an extensive tutorial on Wix - http://wix.tramontana.co.hu/tutorial[^]
«_Superman_» I love work. It gives me something to do between weekends.
Here's how to make a simple .exe (application executable program) in Windows, copy this source to a file that will call main.cpp
// We will declare our header files as our first column
#include<iostream>// Declare namespaces as the second column
// "int main()" serves as the starting point for our program
cout << "Hello user!" << endl;
Compile this and go to your project's folder and double-click on a folder called bin and then double click on the folder called debug. If its not in there click on the other folder which is called release, if you managed to accidently compiled a release version of your program.
And there it is, your first made .exe file.
Simple Greetings and Regards,
Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst).
Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison