in jucer,display “send to back” and “bring to front” for component,my question is:for two components,such as TextEditor ,TextButton,can select them for it to work well------one back ,one front.But for Text------ " g.drawText (L"Your text goes here",
76, 84, 200, 30,
Justification::centred, true);"
“Your text goes here” is not front with TextButton.why?Thank you.
others,how to analyse "FrontOrBackElementAction " and “moveElementZOrder”?,as follows
//-------------------------------------------------------------------------------------------------------------------------------
void PaintRoutine::elementToFront (PaintElement* element, const bool undoable)
{
if (element != 0 && elements.contains (element))
{
if (undoable)
perform (new FrontOrBackElementAction (element, -1), “Move elements to front”);
else
moveElementZOrder (elements.indexOf (element), -1);
}
}
class FrontOrBackElementAction : public PaintElementUndoableAction
{
public:
FrontOrBackElementAction (PaintElement* const element, int newIndex_)
: PaintElementUndoableAction (element),
newIndex (newIndex_)
{
oldIndex = routine.indexOfElement (element);
}
bool perform()
{
showCorrectTab();
PaintElement* e = routine.getElement (oldIndex);
routine.moveElementZOrder (oldIndex, newIndex);
newIndex = routine.indexOfElement (e);
return true;
}
bool undo()
{
showCorrectTab();
routine.moveElementZOrder (newIndex, oldIndex);
return true;
}
private:
int newIndex, oldIndex;
};
void PaintRoutine::moveElementZOrder (int oldIndex, int newIndex)
{
jassert (elements [oldIndex] != 0);
if (oldIndex != newIndex && elements [oldIndex] != 0)
{
elements.move (oldIndex, newIndex);
changed();
}
}
