|
Hehe!
Same for me it's the only thing I've found but for now I was'nt able to assing an Id and I don't want to edit myself the ressources. So I derived the class of the control I wanna use and override everything I need. It's not clean but it work... to my mind they must exist a better way to do so.
Still waiting for!
Thank you for you'r answer
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
To assign an ID you just use one of those #define macros. Editing the resource file won't help because everytime the resources are compiled or edited, or soemthing like that, the resource file is erased and written anew.
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
The way to declare IDs is to go to the Resources tab, right click on the top level folder and select Resource Symbols. It has an icon of text "ID=", which demonstrates its use as defining global IDs. Click "new" and you can make "ID_BUTTON_SOMETHING" and then use that anywhere in your project.
Handling that button will require adding an entry to the message map. In the cpp file of the class you want to receive the message (your view class, most likely), after the BEGIN_MESSAGE_MAP, add the entry:
ON_COMMAND(ID_BUTTON_SOMETHING, OnButtonSomething).
Button clicks should automatically call the function OnButtonSomething, which you will need to declare in the header file (afx_msg void OnButtonSomething()) and implement in the cpp file.
Hope this helps
Jake
|
|
|
|
|
thank you very much for you'r help. this subject is now a good tutorial "HOW TO: Use any kind of control in a view"
now every control work very well
thanks
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
Hi folks
I'm in the middle of my 1st C++ project and would like a little guidance
where my books seem to be embarrassingly lacking.
I would like to have a function which returns an array of floats,except
(strangely) I can't find any examples of such a function or even a decent
prototype.
It's purely a syntactical question..
Anyone?
Thanks
J
|
|
|
|
|
There are several possable ways to do this. Here are two examples
1. Pass the array to the function by reference:
void MyFunction(float* pFloatArray);
2. Dynamically allocate an array to return:
float* MyFunction()
{
float* pFloat = new float[10];
return pFloat;
}
//In this case be sure to delete the memory when you're done!
void main()
{
float* pFloat = MyFunction();
//do your processing
delete [] pFloat;
}
|
|
|
|
|
here a little example just to explain if
// floatarray.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
bool DoSomethingOnFloat(float *paramFloatArray,int paramSizeOfArray);
bool DoSomethingOnFloat2(float paramFloatArray[],int paramSizeOfArray);
int main(int argc, char* argv[])
{
int i;
float FloatArray[10];
for(i=0;i<200;i++)
{
//filling with garbage
FloatArray[i] = (float)i;
}
DoSomethingOnFloat(FloatArray,10);
DoSomethingOnFloat2(FloatArray,10);
return 0;
}
/******************************************************************
here it's the "pointer way" the weird thing to a newbies is the way
we extract data from the array
******************************************************************/
bool DoSomethingOnFloat(float *paramFloatArray,int paramSizeOfArray)
{
int i;
for(i=0;i
|
|
|
|
|
The advice given is correct, but you can also return a vector of floats, which is safer, but may be a subject you'll learn down the track. I'd suggest buying a good book on STL ( Standard Template Library ) and using it, if not for this assignment, then certainly down the track.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Folks,
Thanks for the help.
zero errors!
J
|
|
|
|
|
OK, hope I can explain my question well enough.
I have data I am reading from a database that I am displaying in a ComboBox. Parts display in ComboBox1 and Units displayed in ComboBox2.
Example data might be Screws/Box, Screws/Bag, Screwdriver/Set, Screwdriver/Single etc. When the user selects the Part I want only relevant Units in ComboBox2.
The only way to do this that I can think of is to read the Parts/Units into an array (say CStringArray) and when Part is selected read through array matching Part and listing Unit.
This gives me the advantage of having the Table and Array index in synch though seems to me to be a slow way of finding and displaying the Unit data.
Is there a better way I should be doing this?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
|
Units yes, Parts no.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
use a multimap ( STL ). A map alllows you to link values like this
m_Parts["fridge'} = "Big fat cardboard box";
A multimap allows for more than one value to be stored for the same index, so you could create a map entry for each storage type for each unit, and then populate the second combobox based on the first.
The alternative, which might be better, is to use a map and store an array of ints, I think you can do this
map<cstring, vector<int=""> > m_Entries; // but make sure there is a space between the two '>'s
and then create another vector or strings, which is the full list of available units. The vector of ints stores the indexes of the units for that part. This means each string is stored only once. If you wanted to sacrifice some elegance for speed, you could also make the first entry an int, the index of the item. That would be faster, but harder to debug/change.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Hi
I have a program designed to run in the background. In some events, the program should display information about these events. However, if a fullscreen program is running, the info isn't displayed until the user quits his/her fullscreen app. How can I guarantee that the messagebox / dialog always show up?
|
|
|
|
|
how to connect Crystal report with visual C 6.0
plz can any one send me the snip of code or any web site
Thanks
|
|
|
|
|
Hi,
Is there an utility, which searches libraries for a particular function, which library exports? Or is there any better tool than dumpbin?
Thanks,
Igor Proskuriakov
|
|
|
|
|
Perhaps a stupid question, if i calculate the difference between 2 COleDateTime, the result is a COleDateTimeSpan, and if i use the operator double to this result, i would like to know if the last result is a double?
thanks
gerald
|
|
|
|
|
What does NT stand for in Windows NT?
|
|
|
|
|
Hi,
The NT in Windows NT stands for New Technology!
|
|
|
|
|
|
|
There is also a story about the guy MS hired when they started the
NT project. He (I don't remember his name) was one of the creator
of the VMS operating system for the VAX minicomputer at Digital.
When you take VMS
and increment each letter
you have WNT !
But maybe it's just a coincidence!
|
|
|
|
|
Actually is was the old WMS team that made the first NT.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Another story ..
When you take the name of the sentient computer in 2001 A Space Oddesy, "HAL" and increment each letter you get IBM.
I believe IBM tried to sue Arthur C Clark but he insisted that it was a coincidence.
Steve T.
|
|
|
|
|