Hello,
I’m trying to connect the signal emmited when the refresh button of the toolbar of a canvas is cliked, but without success… Thanks in advance to whom is able to helping me.
Jérémie
Hello,
I’m trying to connect the signal emmited when the refresh button of the toolbar of a canvas is cliked, but without success… Thanks in advance to whom is able to helping me.
Jérémie
Hi Jérémie,
There is no simple/direct way of doing this, but you can use this kind of trick:
[code]#include “TCanvas.h”
#include “TGButton.h”
#include “TGToolTip.h”
#include “Riostream.h”
void AnyButtonClicked()
{
TGButton button = (TGButton)gTQSender;
if (button->WidgetId() == 37) { // refresh
std::cout << "widget ID: " << button->WidgetId() << std::endl;
std::cout << "tooltip text: " << button->GetToolTip()->GetText()->GetString() << std::endl;
}
}
void test_toolbar()
{
TCanvas *c1 = new TCanvas(“c1”, “Simple Canvas”);
if (!c1->GetShowToolBar())
c1->ToggleToolBar();
TQObject::Connect(“TGButton”, “Clicked()”, 0, 0, “AnyButtonClicked()”);
}
[/code]
Cheers, Bertrand.
It works
Thank you bellenot !!!