|
I thought about that as well... there is just some complexity in doing it via inheritance. The most direct way that I can think of going about this is to create protected members in the base class, and write get/set properties for each of the members that I want to have a dynamic name in the inherited class. The code for this would be as follows (the Property class simply allows me to use the syntax "instance.propName" without parentheses):
class base {
private:
double m_Val;
protected:
double getVal() {
return m_Val;
}
void setVal(const double other) {
m_Val = other;
}
public:
...
};
class asdf : public base {
public:
Property<asdf, double> m_asdf;
asdf() {
m_asdf.Container(this);
m_asdf.Getter(&this->getVal);
m_asdf.Setter(&this->setVal);
}
}; Not too terrible.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Skippums wrote: Is there a way to create a class that can be instantiated with different method names
The only way I could perceive is to use the pre-processor...but that would be a real hack.
The problem is that method names are tokens. They are fixed between the pre-processor and the compiler's lexer.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I want to select multiple directories from the dialog box and OnOk I should get the path of all the selected directories.
plz somebody help me.
Thanks in advance
Ranjith
|
|
|
|
|
ranjith_adapu wrote: from the dialog box
What does that mean?
|
|
|
|
|
By using CFileDialog, we can select multiple files. Similarly, I want to select multiple directories.
|
|
|
|
|
ranjith_adapu wrote: I want to select multiple directories from the dialog box...
Which one?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Hi Folks,
I want to write an FSM which starts with an idle state and moves from one state to another based on some event. I am not familiar with coding of FSM and google didn't help. Appreciate if someone could post the C data structure that could be used for the same.
Thanks,
syuga2012
|
|
|
|
|
|
Boost.Statechart[^] might take the pain away
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
struct FSM{
enum { RAMEN=1,ELICHE,CANNELLONI,FARFALLE,TAGLIATELLE,SPAGHETTI };
unsigned int state;
};
FSM IAm;
...
Iam.state=FSM::ELICHE;
... I imagine his noodliness has a lot more states than that, but this is a start. Good luck figuring out the IFsm createUniverse() method.
a finite state machine is usually a markup language.. the prof wants you to draw some pictures w/ some arrows. You could actually use this struct to keep track of your state, if you wanted...
|
|
|
|
|
Actually the only C data structure you need to implement an FSM is int. Each integer value represents a different state of your machine. It's that simple.
|
|
|
|
|
Hi all,
In my main dialog we have a menu, in this menu we have some options as per the option selected we want the values to be changed in all the other 3 dialog boxes that we have in the application.We have actually created all the 3 dialogs in the main dialog using create hence the value is not getting loaded in the other windows..Plz anyone help me
Kind regards
anitha
|
|
|
|
|
AnithaSubramani wrote: we want the values to be changed in all the other 3 dialog boxes
Use the observer pattern[^] or send a user defined message to the other dialog boxes to inform them that the value should be updated.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
AnithaSubramani wrote: We have actually created all the 3 dialogs...
Are they modal or modeless?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
They are modelless dialog boxes.
|
|
|
|
|
Have you tried posting a message to the other dialogs that need updating?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Dear all,
In my program we have written code to download folders from the server to the PC,When the downloading process is started my dialog box disappears.Actually we have 3 dialog boxes and all these 3 boxes are loaded once our application starts and each and every time when i want a window the corresponding window is hide and displayed using FindWindow() and ShowWindow()... What can be the problem Plz anyone help me...
Kind regards
anitha
|
|
|
|
|
Read what you've written and see if you think it makes sense.
The only thing clear is that you have three dialog boxes. I cannot figure out whether you want them hidden or shown and whether the use of FindWindow() is part of the problem or the solution.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
we have 3 dialog boxes and all these 3 boxes are loaded once our application starts and each and every time when i want a window the corresponding window is found using FindWindow() and displayed using ShowWindow()...In one of the dialog when we click a button it starts downloading the files from the server. When it is downloading i need a progress bar to be ruuning in my dialog box. But in my code the dialog box disappears. Please help me to know what can be the problem why the dialog box disappears when the it starts downloading..
|
|
|
|
|
1. Why do you load all the 3 dialog boxes when your application starts? Can't you just show it when required (with DoModal() ?)
2. Why are you using FindWindow() and ShowWindow() at all? Are the dialogs hidden? Or is it that all dialogs are just shown on the screen? That would be really bad.
3. Your dialog box disappears when a download starts? Can you show that relevant piece of code? Relevant code only, please.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
* I tried domodal() in one of my application but if i use domodal() i can change between dialog only 30 or 40 times after that it shows a message which says resource not available.
|
|
|
|
|
Hi,
May i know how can i change the window style(name of the window...,changing window borders..etc..) in the code ...
i have tried to change in Oncreate function in Mainframe.cpp but no result...
Pls help me regarding the same..
|
|
|
|
|
ex.: remove the ClientEdge style:
LONG windowLong = GetWindowLong(hWnd, GWL_EXSTYLE);
windowLong = windowLong & (~WS_EX_CLIENTEDGE);
SetWindowLong(hWnd, GWL_EXSTYLE, windowLong);
|
|
|
|
|
Thanks for ur reply....
I need to write this code in onpaint()....??
or i need to make changes in oncreate() if not may i know the purpose of oncretae() func in mainframe.cpp..
Please correct me if im wrong...
|
|
|
|