Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

StaticTextMouseMoved is not called.

Anonymous
Not applicable
I was created simple UI with static text. And I want to do anything when cursor moves on the text, but the function StaticTextMouseMoved is not calling. Could you tell me if I do anything wrong?
class PluginAvailabilityManagementDialog : public DG::ModalDialog,
  public DG::PanelObserver,
  public DG::ButtonItemObserver,
  public DG::CompoundItemObserver,
  public DG::StaticTextObserver
{
public:
  PluginAvailabilityManagementDialog(GSResModule dialResModule);
  ~PluginAvailabilityManagementDialog();

private:
  virtual void PanelOpened(const DG::PanelOpenEvent& ev) override;
  virtual void ButtonClicked(const DG::ButtonClickEvent& ev) override;
  virtual void  StaticTextClicked(const DG::StaticTextClickEvent& ev) override;
  virtual void  StaticTextDoubleClicked(const DG::StaticTextDoubleClickEvent& ev) override;
  virtual void  StaticTextMouseMoved(const DG::StaticTextMouseMoveEvent& ev, bool* noDefaultCursor) override;

  static const short PLUGIN_AVAILABILITY_MANAGEMENT_DIALOG_RESID = 32530;
  enum
  {
    LaterButtonID = 2,
    UpdateNowButtonID = 5,
    NewFeaturesButtonID = 6,
    textID = 3,
  };

  DG::Button laterButton_;
  DG::Button updateNowButton_;
  DG::Button newFeaturesButton_;
  DG::LeftText leftText_;
};

PluginAvailabilityManagementDialog::PluginAvailabilityManagementDialog(GSResModule dialResModule) :
    DG::ModalDialog(dialResModule, PLUGIN_AVAILABILITY_MANAGEMENT_DIALOG_RESID, dialResModule),
    laterButton_(GetReference(), LaterButtonID),
    updateNowButton_(GetReference(), UpdateNowButtonID),
    newFeaturesButton_(GetReference(), NewFeaturesButtonID),
  leftText_(GetReference(), textID)
{
    AttachToAllItems(*this);
}

PluginAvailabilityManagementDialog::~PluginAvailabilityManagementDialog()
{
}

void PluginAvailabilityManagementDialog::PanelOpened(const DG::PanelOpenEvent& ev)
{
}

void PluginAvailabilityManagementDialog::ButtonClicked(const DG::ButtonClickEvent& ev)
{
}

void PluginAvailabilityManagementDialog::StaticTextClicked(const DG::StaticTextClickEvent& ev)
{

}

void PluginAvailabilityManagementDialog::StaticTextDoubleClicked(const DG::StaticTextDoubleClickEvent& ev)
{
  leftText_.SetTextColor(Gfx::Color::Green);
}

void PluginAvailabilityManagementDialog::StaticTextMouseMoved(const DG::StaticTextMouseMoveEvent& ev, bool* noDefaultCursor)
{
  DG::InformationAlert("Called","","OK");
}

/* ---------------------------------------------------------- Dialog */
'GDLG' 32530 Modal 40 40 445 561 "Dialog" {
/* [ 1] */ Icon  0 0 445 55 10018
/* [ 2] */ Button  141 412 160 44 LargePlain "Later"
/* [ 3] */ LeftText  110 115 223 19 LargeBold "Text"
/* [ 4] */ LeftText  121 150 201 28 LargePlain vCenter "Text center"
/* [ 5] */ Button  141 481 160 25 LargeUnderline noFrame BevelEdge "Update now"
/* [ 6] */ Button  141 170 160 25 LargeUnderline noFrame BevelEdge "features"
}
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Viktor Kovacs
Graphisoft
Graphisoft
For performance reasons mouse move events are not called by default. Try to enable it on your control by calling the below function in your dialog's constructor:

myStaticText.EnableMouseMoveEvent ();

View solution in original post

3 REPLIES 3
Solution
Viktor Kovacs
Graphisoft
Graphisoft
For performance reasons mouse move events are not called by default. Try to enable it on your control by calling the below function in your dialog's constructor:

myStaticText.EnableMouseMoveEvent ();
Anonymous
Not applicable
Thanks a lot. It's work!!!
Viktor wrote:
For performance reasons mouse move events are not called by default. Try to enable it on your control by calling the below function in your dialog's constructor:

myStaticText.EnableMouseMoveEvent ();
Anonymous
Not applicable
When I hover over the text, the StaticTextMouseMoved event is called, when I move the cursor from the text, no events are called. Are there any events for such a case?
For example:
When the cursor is over the text, the text turns red. When the cursor is not over the text, the text will be blue.
Viktor wrote:
For performance reasons mouse move events are not called by default. Try to enable it on your control by calling the below function in your dialog's constructor:

myStaticText.EnableMouseMoveEvent ();