|
is there some way to call OnKillFocus Method of editboz against button clicking.
|
|
|
|
|
ani_ikram wrote: s there some way to call OnKillFocus Method of editboz against button clicking.
Yes, by clicking outside the edit box.
or you can explicitly set focus to some control other than the edit box after setting it first on the edit box. ON another note, OnKillFocus is called by the framework, when the control looses the focus.
or
Try SendMessage with WM_KILLFOCUS as one of the params (Just a guess)
Hope this helps..
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
ani_ikram wrote: way to call OnKillFocus Method of editboz against button clicking
If you click button then the focus will be set to button. So the OnKillFocus of editbox will be called, provided you have mapped like
ON_EN_KILLFOCUS(IDC_EDIT1, OnKillFocus)
|
|
|
|
|
Did you declare OnKillFocus for editbox?
|
|
|
|
|
Simply map "OnKillFoucus" to the click event of button
ON_BN_CLICKED(IDC_BUTTON, OnKillFoucus)
|
|
|
|
|
i am having problem with sscanf being how I say o.O
line exactly
<br />
"spawn = 1648\t3409\t3536\t0\t3410\t3557\t3408\t3535\t2\tCow"<br />
the code I use
struct Pos {
int x;
int y;
};
int npcId = 0;
Pos coords;
int heightLevel = 0;
Pos moveRange1;
Pos moveRange2;
int direction;
sscanf(line,"spawn%*[ ]=%*[ ]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d",&npcId, &coords.x, &coords.y, &heightLevel, &moveRange1.x, &moveRange1.y, &moveRange2.x, &moveRange2.y, &direction);
"spawn = 1648\t3409\t3536\t0\t3410\t3557\t3408\t3535\t2\tCow"
outputs =
npcId: 0 (has to be 1648) (wrong for no reason o.O)
coords.x: 3412
coords.y: 3536
heightLevel: 0
moveRange1.x: 0 (wrong for again no reason as the format pattern matches)
moveRange1.y: 3557
moveRange2.x: 3408
moveRange2.y: 3535
direction: 2
the last \tCow is to be ignored its not really needed.
So whats wrong really
|
|
|
|
|
I just copied your code and tested... I am getting correct results...
|
|
|
|
|
I now its right.. because I used the same code.. just a little modified for another part of loading files.. and it works perfectly.. but this.. doesn't.. i should post full method can u try it?. I believe my error is divine intervention because god doesn't want me to become a programmer.
#ifndef NPCHANDLER_H
#define NPCHANDLER_H
#include <stdio.h>
class NpcHandler {
public:
NpcHandler();
~NpcHandler();
void loadAutoSpawn();
};
#endif
</stdio.h>
NpcHandler::NpcHandler() {
loadAutoSpawn();
}
void NpcHandler::loadAutoSpawn() {
printDebug("Loading autospawn list\n");
FILE* dataIn;
char line[80];
char* ptrOffset;
int numTabs = 0;
int numOfNpcs = 0;
int npcId = 0;
Pos coords;
int heightLevel = 0;
Pos moveRange1;
Pos moveRange2;
int direction;
dataIn = fopen("data/autospawn.cfg", "rb");
if(dataIn) {
while(!feof(dataIn)) {
fgets(line, sizeof(line), dataIn);
if((ptrOffset = strstr(line, "spawn =")) != NULL) {
numTabs = 0;
for(int i = 0; i < strlen(line); i++)
if(line[i] == '\t') numTabs++;
if(numTabs == 9) {
sscanf(line,"spawn%*[ ]=%*[ ]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d%*[\t]%d",&npcId, &coords.x, &coords.y, &heightLevel, &moveRange1.x, &moveRange1.y, &moveRange2.x, &moveRange2.y, &direction);
printf("DAM U npcID = %d\n", npcId);
printf("coords x = %d\n", coords.x);
Sleep(1000);
} else {
}
numOfNpcs++;
}
}
fclose(dataIn);
} else {
}
}
and here is the data file..
autospawn.cfg successfully uploaded!
Here is your link:
http://uppit.com/URNOXU
|
|
|
|
|
Cbadboy wrote: I believe my error is divine intervention because god doesn't want me to become a programmer.
That's a joke...
BTW, first you should identify which line of data is having the error. Did you try so?
|
|
|
|
|
there is no errors.. the line is correct.. just can't solve
|
|
|
|
|
Can someone plz try it.. i'm serious it has no errors.. i can't even see any by eye.. but it skips some..
|
|
|
|
|
Cbadboy wrote: i'm serious it has no errors...
Well it obviously does or you would not be asking for help. Use the debugger.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Debugger isn't helping what do u think I've been using this whole time before I posted question.. it just breakpoints on 1 line.. i see everything inside sscan the tokens and such... I even see the npcId value but it doesnt set up inside the npcId datatype.. which remains zero.................................
|
|
|
|
|
Cbadboy wrote: Debugger isn't helping what do u think I've been using this whole time before I posted question...
How could I possibly know the answer to that since you never mentioned what you tried?
As someone that helps on this board FOR FREE AND IN MY SPARE TIME, my assumptions are based solely on the information, or lack thereof, that you provide. If you want us to know something, tell us.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Cbadboy wrote: moveRange1.x: 0 (wrong for again no reason as the format pattern matches)
If you replaced the 0 in line to some other number, what value would moveRange1.x have?
Cbadboy wrote: So whats wrong really
How about coords.x having a value of 3412 instead of 3419?
What does sscanf() return?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
6 and problem is solved..
instead of %d i had to use %hd
for some reason int's in structs are different datatype yup just a lesson i learned
|
|
|
|
|
Cbadboy wrote: instead of %d i had to use %hd
Which means you had a short int .
Cbadboy wrote: for some reason int's in structs are different datatype
No such difference exists.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi All
I have problem to store a string type values in array.Simple i did it but my problem is how can i define a size of array,when i don't know how many data is came in array.I am stroing data in array at the run time.And don't want to fixed the size of array.Plz help me
|
|
|
|
|
Try the CArray class in the MFC and if you dont use MFC, check the vector class.
|
|
|
|
|
Nprog wrote: to store a string type values in array
Use CStringArray
|
|
|
|
|
You can also approach in STL way with std::string/std::wstring with containers like vectors, deque, list etc...
e.g vector<string> arrString; defines a string array in STL way. you can also approach other containers based on your use. Probably a vector will do.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
|
I was wandering if you guys know of any resources on web browser development
Plasma Steel Games | Web Administrator
FlashCoded.net | Web Administrator
|
|
|
|
|
Huh?
Neither Google nor CodeProject's search engines are working right now??
|
|
|
|
|
Plasma Steel Games wrote: I was wandering
Stop wandering and start searching in Google.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|