I want to pass an array to a wxColour element:
int COLOUR_DEFAULT [4] = {0, 0, 100, 255};
myelement->SetBackgroundColour(*COLOUR_DEFAULT);
But it does not work.
If I do:
#define COLOUR_DEFAULT {100, 100, 100, 255}
myelement->SetBackgroundColour(COLOUR_DEFAULT);
….it works. How can I make it work with the variable?
答案 0 :(得分:1)
In WxWidgets, if you want to make a WxColour class, you must define the variable as
wxColour COLOUR_DEFAULT(0, 0, 100, 255);
You can not pass an integer array directly to a function expecting a WxColour parameter.
Now you can simply type the following (it is no longer a pointer, so the *
is not needed):
myelement->SetBackgroundColour(COLOUR_DEFAULT);