I have an open Qt Mac app.
I am clicking the app Icon
Is there a way to get a notification for this in the app?
I couldn't get the original answer to compile properly due to deprecation warnings (post-OS X 10.5) and type errors; I changed a few type names and got it to compile, but the code still didn't work.
It turns out that newer versions of Qt (4.8.7+, including 5.x; I use 5.4.1) implement the method we want to add, and class_addMethod fails if the method already exists. See this QTBUG.
Note: the above bug report contains a slightly different solution (I found it after fixing the issue myself).
One solution, that works for me, is to check if the method exists. If it does, we replace it. If not, we simply add it.
I have not tested this code on older Qt versions, but it uses OPs logic, so it should work.
Here's my code. As in OPs case, all code is in the .cpp file of a QApplication subclass.
#ifdef Q_OS_MAC
#include <objc/objc.h>
#include <objc/message.h>
void setupDockClickHandler();
bool dockClickHandler(id self,SEL _cmd,...);
#endif
My QApplication subclass constructor contains
#ifdef Q_OS_MAC
setupDockClickHandler();
#endif
And finally, somewhere in the same file (at the bottom, in my case):
#ifdef Q_OS_MAC
void setupDockClickHandler() {
Class cls = objc_getClass("NSApplication");
objc_object *appInst = objc_msgSend((objc_object*)cls, sel_registerName("sharedApplication"));
if(appInst != NULL) {
objc_object* delegate = objc_msgSend(appInst, sel_registerName("delegate"));
Class delClass = (Class)objc_msgSend(delegate, sel_registerName("class"));
SEL shouldHandle = sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:");
if (class_getInstanceMethod(delClass, shouldHandle)) {
if (class_replaceMethod(delClass, shouldHandle, (IMP)dockClickHandler, "B#:"))
qDebug() << "Registered dock click handler (replaced original method)";
else
qWarning() << "Failed to replace method for dock click handler";
}
else {
if (class_addMethod(delClass, shouldHandle, (IMP)dockClickHandler,"B#:"))
qDebug() << "Registered dock click handler";
else
qWarning() << "Failed to register dock click handler";
}
}
}
bool dockClickHandler(id self,SEL _cmd,...) {
Q_UNUSED(self)
Q_UNUSED(_cmd)
// Do something fun here!
qDebug() << "Dock icon clicked!";
// Return NO (false) to suppress the default OS X actions
return false;
}
#endif
Also see the Apple documentation on the applicationShouldHandleReopen:hasVisibleWindows: method.
In order for this to compile, you also need to link with some extra frameworks.
Using qmake, I added the following to my .pro file:
LIBS += -framework CoreFoundation -framework Carbon -lobjc
Those flags are of course exactly what you should add to the c++ or clang++ command line, if you compile manually.
That should be everything that's required.
It's crazy, but i got it, and without any Objective-C coding:
I derived QApplication. In the *.cpp portion of my derived class i put:
#ifdef Q_OS_MAC
#include <objc/objc.h>
#include <objc/message.h>
bool dockClickHandler(id self,SEL _cmd,...)
{
Q_UNUSED(self)
Q_UNUSED(_cmd)
((MyApplictionClass*)qApp)->onClickOnDock();
return true;
}
#endif
in my derived application class constructor I put:
#ifdef Q_OS_MAC
objc_object* cls = objc_getClass("NSApplication");
SEL sharedApplication = sel_registerName("sharedApplication");
objc_object* appInst = objc_msgSend(cls,sharedApplication);
if(appInst != NULL)
{
objc_object* delegate = objc_msgSend(appInst, sel_registerName("delegate"));
objc_object* delClass = objc_msgSend(delegate, sel_registerName("class"));
const char* tst = class_getName(delClass->isa);
bool test = class_addMethod((objc_class*)delClass, sel_registerName("applicationShouldHandleReopen:hasVisibleWindows:"), (IMP)dockClickHandler,"B#:");
if (!test)
{
// failed to register handler...
}
}
#endif
Added this simple method to my application class (note it's referred to from the handler at the top of my answer)
void MyApplictionClass::onClickOnDock()
{
// do something...
}
Works like charm.
Starting from Qt5.4.0 you can handle QEvent, that related to click on dock: QEvent::ApplicationActivate.
https://bugreports.qt.io/browse/QTBUG-10899
https://doc.qt.io/qt-5/qevent.html
The problem with QEvent::ApplicationActivate is that it will be emitted for every activation - eg., even if you switch to the app on Application Switcher. The native behavior is to show the app only on Dock icon click, not when you are switching by cmd+tab.
But, there is a hack that works at least for Qt 5.9.1. The Dock icon click produces 2 sequential QEvent::ApplicationStateChangeEvent events, meanwhile cmd+tab - only one.
So, this code will emit Dock click signal quite accurately. App class is the application class inherited from QApplication and also an event filter for itself.
bool App::eventFilter(QObject* watched, QEvent* event)
{
#ifdef Q_OS_MACOS
if (watched == this && event->type() == QEvent::ApplicationStateChange) {
auto ev = static_cast<QApplicationStateChangeEvent*>(event);
if (_prevAppState == Qt::ApplicationActive
&& ev->applicationState() == Qt::ApplicationActive) {
emit clickedOnDock();
}
_prevAppState = ev->applicationState();
}
#endif // Q_OS_MACOS
return QApplication::eventFilter(watched, event);
}
Related
I have a problem using a library for a mqtt-client i got from GitHub (https://github.com/emqtt/qmqtt).
Im using Qt Creator 4.0.3 with Qt Version Qt 5.7.0 and compile with MinGW 5.3.0 on Windows 10.
I have already looked up some other answers on the Internet but they are mostly about compile or linking errors.
My problem is that the code is just not doing what it is supposed to (it does kind of nothing).
I'm already having problems with the example on the title screen (link above) which connects to a server/broker. It does simply nothing, i don't even get error messages or any other feedback.
My Code:
I have a Smartpointer to a Client Object
QScopedPointer<QMQTT::Client> client(new QMQTT::Client(QHostAddress("192.168.8.50"), 1883));
The Address and Port are correct, I already tested this with MQTTlens for Google Chrome.
Then I have a seperate class to handle my input and output (I use Multithreading). This class sends & receives signals so it can control the Client / give feedback to the user (through Console Output).
class MainIO : public QObject
{
Q_OBJECT
public:
explicit MainIO(QString clientId = "", QObject *parent = 0);
void mainMenue();
private:
QVector<QString> m_mainMenueStrings;
QString m_clientId;
signals:
void connectToHost();
void disconnectFromHost();
void subscribe(const QString &topic, const quint8 qos);
void unsubscribe(const QString &topic);
void publish(const QMQTT::Message &message);
public slots:
void onClientConnected();
void onClientDisconnected();
void onClientPublished();
void onClientError(const QMQTT::ClientError error);
void onClientReceived(const QMQTT::Message &message);
void add();
void subtract();
};
I move an object of the class to a thread in my main
QThread mainIOThread;
IoTClient::MainIO control(clientId);
control.moveToThread(&mainIOThread);
and then i connect the signals with slots before starting the thread
QObject::connect(&mainIOThread, &QThread::started
, &control, &IoTClient::MainIO::mainMenue);
/* Control -> Client */
QObject::connect(&control, &IoTClient::MainIO::connectToHost
, client.data(), &QMQTT::Client::connectToHost);
QObject::connect(&control, &IoTClient::MainIO::subscribe
, client.data(), &QMQTT::Client::subscribe);
QObject::connect(&control, &IoTClient::MainIO::unsubscribe
, client.data(), &QMQTT::Client::unsubscribe);
QObject::connect(&control, &IoTClient::MainIO::publish
, client.data(), &QMQTT::Client::publish);
/* Client -> Control */
QObject::connect(client.data(), &QMQTT::Client::connected
, &control, &IoTClient::MainIO::onClientConnected);
QObject::connect(client.data(), &QMQTT::Client::disconnected
, &control, &IoTClient::MainIO::onClientDisconnected);
QObject::connect(client.data(), &QMQTT::Client::error
, &control, &IoTClient::MainIO::onClientError);
QObject::connect(client.data(), &QMQTT::Client::published
, &control, &IoTClient::MainIO::onClientPublished);
QObject::connect(client.data(), &QMQTT::Client::received
, &control, &IoTClient::MainIO::onClientReceived);
mainIOThread.start();
The mainMenue-Method looks as follows:
void MainIO::mainMenue()
{
std::system("cls");
qDebug().noquote().nospace() << (tr("clients/") + m_clientId +
tr("/state"));
/* Print Menue */
qDebug().noquote().nospace() << "QMQTT-Client";
for (int i = 0; i < m_mainMenueStrings.size(); i++)
{
qDebug().noquote().nospace() << "\t(" << i+1 << ") " <<
m_mainMenueStrings[i];
}
qDebug().noquote().nospace() << "Ihre Auswahl: ";
/* select choice */
int option = -1;
while ((option >= m_mainMenueStrings.size()) || (option < 0)) {
std::cin >> option;
}
option--;
switch(option) {
case 0: emit this->connectToHost();
break;
case 1: add();
break;
case 2: subtract();
break;
case 3: emit this->disconnectFromHost();
break;
default:
qDebug().noquote().nospace() << "Fehlerhafte Eingabe";
}
}
The Console output looks kinda like following:
(1) connect
(2) add
...
your input:_
after I send some input (1 for connect) nothing happens. i dont get any error (i have connected the error signal from the client to a error slot) or other signals.
I have already tested this connection in the source code and can't come to a conclusion, because it just makes no sense (to me) that the client won't connect to the broker.
The code only fails with Windows, it does work with Linux.
I have solved this problem. It was, that the qmake version in the project did not work properly after deployment (on Windows).
I used the Qbs version, but this one could not be deployed. I built it and copied the generated files needed (.dll and so on) into the corresponding Qt directories on my machine.
I use Qt to develop my application, and I want to listen the global mouse and keyboard events, so I can do something after detect these events. On windows platform, I use SetWindowsHookEx API. But I don't know how to do the similar thing on Linux.
My code on Windows as below:
/*********************listen mouse event*****************************/
mouseHook = SetWindowsHookEx(WH_MOUSE_LL, mouseProc, NULL, 0);
if (mouseHook == NULL) {
qDebug() << "Mouse Hook Failed";
}
/*********************listen keyboard event*****************************/
keyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, keyBoardProc, NULL, 0);
if (keyboardHook == NULL) {
qDebug() << "Keyboard Hook Failed";
}
Thank you for your answer sincerely!
Use the vast and helpful Qt Event System. That way you can use the same code on Windows as well as Linux.
I would recommend adding a eventFilter to your application. If the event caught is a QEvent::KeyPress or QEvent::MouseButtonPress( or QEvent::MouseButtonDblClick based on your requirement), take the necessary action.
If the event filter is to be applied for a particular widget in the main window, in the constructor of the main window, add
ui->myWidget->installEventFilter(this);
Now you need to implement the protected method eventFilter for the main window.
In the header file.
protected:
bool eventFilter(QObject* obj, QEvent* event);
Implementation
bool MainWindow::eventFilter(QObject* obj, QEvent* event)
{
if(event->type() == QEvent::KeyPress)
{
QKeyEvent* keyEvent = static_cast<QKeyEvent *>(event);
qDebug() << "Ate key press " << keyEvent->text();
return true;
}
else if(event->type() == QEvent::MouseButtonPress)
{
qDebug() << "Mouse press detected";
return true;
}
// standard event processing
return QObject::eventFilter(obj, event);
}
It is also possible to filter all events for the entire application, by installing an event filter on the QApplication or QCoreApplication object. You can read more on that from the documentation link I provided in the first line.
If the event filter has to be reused, I would recommend adding a dummy class which inherits from QObject. In this class you can just implement the function eventFilter. You can now pass an instance of this class to the function installEventFilter and communicate with the other objects using SIGNALS.
EDIT:
If you are looking to capture events even outside the application, Qt itself does not support that (yet). But you can use the Qxt library that adds support for it using the QxtGlobalShortcut class.
I use the events QEvent::ApplicationActivate and QEvent::ApplicationDeactivate to show/hide some part of my app when needed.
But now, thoses events are flagged as deprecated :
This enum has been deprecated. Use ApplicationStateChange instead.
So I tried to switch to this event. It is triggered when it should, but I can't find a way to get the application state with some sort of cast or any getters.
Any ideas ?
Just as for any other event, you need to cast it to more specific type to get event properties. The class is QApplicationStateChangeEvent. The documentation is surprisingly silent about it, but it exists and is declared in event.h. The following code works fine in my Qt 5.1 installation:
#include <QApplicationStateChangeEvent>
bool MainWindow::eventFilter(QObject *o, QEvent *e) {
if (e->type() == QEvent::ApplicationStateChange) {
qDebug() << "state:"
<< static_cast<QApplicationStateChangeEvent*>(e)->applicationState();
}
return QMainWindow::eventFilter(o, e);
}
I am starting a QT5 application with a rather complex design based on Qt Widgets. It runs on Beagleboard with a touchscreen. I will have a rather weird local invention instead of the LCD display. It's a laser painting on acrylic plate. It has no driver yet. To actually update a screen I must create a screenshot of the window as bitmap, turn it to grayscale and feed to a proprietary library, which will handle the laser. It should look cute, when ready. Unfortunately, the laser blinks on update, so I cannot just make screenshots on timer, or it will be jerky like hell.
I need to run a function every time a meaningful update of GUI happens, while preferably ignore things like button being pressed and released. Is there some way to create a hook without subclassing every single Qt Widget I will use? The only way to do this I know is to override paintEvent of everything. I want a simpler solution.
Possible assumptions are: the application will be running under X server with dummy display, will be the only GUI app running. Some updates happen without user input.
The code below does it. It doesn't dig too deeply into the internals of Qt, it merely leverages the fact that backing store devices are usually QImages. It could be modified to accommodate OpenGL-based backing stores as well.
The WidgetMonitor class is used to monitor the widgets for content changes. An entire top-level window is monitored no matter which particular widget is passed to the monitor(QWidget*) method. You only need to call the monitor method for one widget in the window you intend to monitor - any widget will do. The changes are sent out as a QImage of window contents.
The implementation installs itself as an event filter in the target window widget and all of its children, and monitors the repaint events. It attempts to coalesce the repaint notifications by using the zero-length timer. The additions and removals of children are tracked automagically.
When you run the example, it creates two windows: a source window, and a destination window. They may be overlapped so you need to separate them. As you resize the source window, the size of the destination's rendition of it will also change appropriately. Any changes to the source children (time label, button state) propagate automatically to the destination.
In your application, the destination could be an object that takes the QImage contents, converts them to grayscale, resizes appropriately, and passes them to your device.
I do not quite understand how your laser device works if it can't gracefully handle updates. I presume that it is a raster-scanning laser that runs continuously in a loop that looks roughly like this:
while (1) {
for (line = 0; line < nLines; ++line) {
drawLine();
}
}
You need to modify this loop so that it works as follows:
newImage = true;
QImage localImage;
while (1) {
if (newImage) localImage = newImage;
for (line = 0; line < localImage.height(); ++line) {
drawLine(line, localImage);
}
}
You'd be flipping the newImage flag from the notification slot connected to the WidgetMonitor. You may well find out that leveraging QImage, and Qt's functionality in general, in your device driver code, will make it much easier to develop. Qt provides portable timers, threads, collections, etc. I presume that your "driver" is completely userspace, and communicates via a serial port or ethernet to the micro controller that actually controls the laser device.
If you will be writing a kernel driver for the laser device, then the interface would be probably very similar, except that you end up writing the image bitmap to an open device handle.
// https://github.com/KubaO/stackoverflown/tree/master/questions/surface-20737882
#include <QtWidgets>
#include <array>
const char kFiltered[] = "WidgetMonitor_filtered";
class WidgetMonitor : public QObject {
Q_OBJECT
QVector<QPointer<QWidget>> m_awake;
QBasicTimer m_timer;
int m_counter = 0;
void queue(QWidget *window) {
Q_ASSERT(window && window->isWindow());
if (!m_awake.contains(window)) m_awake << window;
if (!m_timer.isActive()) m_timer.start(0, this);
}
void filter(QObject *obj) {
if (obj->isWidgetType() && !obj->property(kFiltered).toBool()) {
obj->installEventFilter(this);
obj->setProperty(kFiltered, true);
}
}
void unfilter(QObject *obj) {
if (obj->isWidgetType() && obj->property(kFiltered).toBool()) {
obj->removeEventFilter(this);
obj->setProperty(kFiltered, false);
}
}
bool eventFilter(QObject *obj, QEvent *ev) override {
switch (ev->type()) {
case QEvent::Paint: {
if (!obj->isWidgetType()) break;
if (auto *window = static_cast<QWidget *>(obj)->window()) queue(window);
break;
}
case QEvent::ChildAdded: {
auto *cev = static_cast<QChildEvent *>(ev);
if (auto *child = qobject_cast<QWidget *>(cev->child())) monitor(child);
break;
}
default:
break;
}
return false;
}
void timerEvent(QTimerEvent *ev) override {
if (ev->timerId() != m_timer.timerId()) return;
qDebug() << "painting: " << m_counter++ << m_awake;
for (auto w : m_awake)
if (auto *img = dynamic_cast<QImage *>(w->backingStore()->paintDevice()))
emit newContents(*img, w);
m_awake.clear();
m_timer.stop();
}
public:
explicit WidgetMonitor(QObject *parent = nullptr) : QObject{parent} {}
explicit WidgetMonitor(QWidget *w, QObject *parent = nullptr) : QObject{parent} {
monitor(w);
}
Q_SLOT void monitor(QWidget *w) {
w = w->window();
if (!w) return;
filter(w);
for (auto *obj : w->findChildren<QWidget *>()) filter(obj);
queue(w);
}
Q_SLOT void unMonitor(QWidget *w) {
w = w->window();
if (!w) return;
unfilter(w);
for (auto *obj : w->findChildren<QWidget *>()) unfilter(obj);
m_awake.removeAll(w);
}
Q_SIGNAL void newContents(const QImage &, QWidget *w);
};
class TestWidget : public QWidget {
QVBoxLayout m_layout{this};
QLabel m_time;
QBasicTimer m_timer;
void timerEvent(QTimerEvent *ev) override {
if (ev->timerId() != m_timer.timerId()) return;
m_time.setText(QTime::currentTime().toString());
}
public:
explicit TestWidget(QWidget *parent = nullptr) : QWidget{parent} {
m_layout.addWidget(&m_time);
m_layout.addWidget(new QLabel{"Static Label"});
m_layout.addWidget(new QPushButton{"A Button"});
m_timer.start(1000, this);
}
};
int main(int argc, char **argv) {
QApplication app{argc, argv};
TestWidget src;
QLabel dst;
dst.setFrameShape(QFrame::Box);
for (auto *w : std::array<QWidget *, 2>{&dst, &src}) {
w->show();
w->raise();
}
QMetaObject::invokeMethod(&dst, [&] { dst.move(src.frameGeometry().topRight()); },
Qt::QueuedConnection);
WidgetMonitor mon(&src);
src.setWindowTitle("Source");
dst.setWindowTitle("Destination");
QObject::connect(&mon, &WidgetMonitor::newContents, [&](const QImage &img) {
dst.resize(img.size());
dst.setPixmap(QPixmap::fromImage(img));
});
return app.exec();
}
#include "main.moc"
I am trying to build an QT State Maschine. I have some States, and for those States i need Transition that alter the Graphics on my gui.
The Problem i having and the only reason i am asking, i am Stuck and Point 1.
The compiler cant identifie the QTEventTransition. I have QT 4.6 wroking with QT Creator on Windows.
The compiler does not find Header #include < QtEventTransition >
This is what i did i never did this bevor but i think it should be correct, I have A Header File where i have my Transitions Declareted like this:
class validateBoatTransition : public QtEventTransition
{
public:
validateBoatTransition(Widget *widget,ServerSkeleton* server);
protected:
bool eventTest(QEvent *e);
void onTransition(QEvent *);
private:
Chart* ourChart;
Message current;
BarelySocket* myBarelySocket;
};
Than i have my Cpp File where i have this:
validateBoatTransition::validateBoatTransition(Widget *widget,ServerSkeleton* server)
{
}
void validateBoatTransition::onTransition(QEvent *e)
{
/*
My Logik should go here
*/
}
What i want is that if the Transition is activated by an Button (clicked) it should fire this transition!
I searched the net, but cant find an solution. Can i do that? I should i think.
Yours Thomas
Maybe you should take a look to signals/slot mechanism. I think this is what you need to achieve what you want.
Make your onTransition function a slot instead of an event handler and connect it to the signal clicked of the button.
class validateBoatTransition : public QtEventTransition
{
...
public slots:
void onTransition();
...
}
Somewhere in your code, connect the button to the slot:
QObject::connect(myButton, signal(clicked()), myValidateBoatTransition, slot(onTransition());
Each time the button will be clicked the execution will go through the onTransition function.
I think you're trying to use wrong classes/mechanisms to achieve your goals. If I understand you correctly, you have some GUI and after clicking some button you want to validate some stuff and if this validation is successful the state machine should change it's state. I'd write it this way:
Create some class to handle validation:
class BoatValidator : public QObject
{
Q_OBJECT
// boring stuff like constructor, etc.
public slots:
void validate()
{
if ( /*your validation logic goes here*/ ) {
emit boatTransition();
}
}
signals:
void boatTransition(); // emitted if validation is succesful
};
Then you connect your QPushButton::clicked() to BoatValidator::validate() and use BoatValidator::boatTransition() signal to drive the state machine:
QStateMachine machine;
QState *state1 = new QState(&machine);
QState *state2 = new QState(&machine);
// more state machine setup
// connect validator and button
QPushButton button;
BoatValidator validator;
connect(&button, SIGNAL(clicked()), &validator, SLOT(validate()));
// use validator to change states
state1->addTransition(&validator, SIGNAL(boatTransition()), state2);
Generally I'd use signal to drive state machine, unless some transitions are obviously event driven (for example some QEvent::Enter/QEvent::Leave on GUI widgets, etc.).
What i wanted to do is build a Qt State Machine. The Problem was that i could not trigger my own Transitions (let alone with my own Events). The answers given are good but would lead to a messy code. Why should i use a QT State Machine if i could not use the QT Transitions?
The First Problem above is solved, if you create a new Project. QT Creater is very annoying.
But here now my solution , may it help others.
First my State:
class ServerState : public QState
{
Q_OBJECT
public:
ServerState(QPushButton * pushButton);
~ServerState();
public slots:
void buttonWasClicked();
protected:
void onEntry(QEvent *e);
void onExit(QEvent *e);
private:
QPushButton * pushButton;
};
Normal, but you see i added an Slot. This slot enables me to connect a bottom signal or a Widget Mouse Press Signal to it !
Like this:
QStateMachine *machine = new QStateMachine(this);
ServerState *s1 = new ServerState(connectButton);
connect(connectButton, SIGNAL(clicked()), s1, SLOT(buttonWasClicked()));
machine->addState(s1);
s1->addTransition(connectTransition);
all i needed to to is now fire a declared Event like this one :
#define RegisterToServerEventIndex User+5
class ConnectToServerEvent : public QEvent
{
public:
ConnectToServerEvent() : QEvent(QEvent::Type(QEvent::ConnectToServerEventIndex))
{}
};
when the slot was called:
void ServerState::buttonWasClicked()
{
this->machine()->postEvent(new ConnectToServerEvent());
qDebug("ServerState::buttonWasClicked");
}
The QT State Machine would now call all the Transitions , link with this state:
ConnectToServerTransition::ConnectToServerTransition(QPushButton * pushButtonB,ServerSkeleton* serverSkeleton)
{
this->pushButtonB = pushButtonB;
this->pushButtonB->hide();
this->serverSkeleton = serverSkeleton;
qDebug("ConnectToServerTransition::ConnectToServerTransition");
}
bool ConnectToServerTransition::eventTest(QEvent *e)
{
return (e->type() == QEvent::ConnectToServerEventIndex);
}
void ConnectToServerTransition::onTransition(QEvent *e)
{
if (true == this->serverSkeleton->initalisieren())
{
this->pushButtonB->show();
}else{
qDebug("Conection to Server faild");
}
emit kill();
return;
}
Whats so great that i dare to post?
Well first you can link a Qt SM to a widget where a mouse press event , or somthing else, is called and process the raw data to a an level you need later in your program. All you then need to do is, to emit the singal:
void Widget::mousePressEvent(QMouseEvent *event){
Coordinates current;
current.line = 0;
current.row = A;
current.row = (Row) (event->x() / 30); // 30 = breite von einen Feld
current.line = event->y() / 30; // 30 = länge von einen Feld
emit this->clicked(current);
return;
}
Then this enhenced information (current) is passed to the slot at my state, where i chose to call the correct transition that does the work. You could link more transitions to it, if you need it.
But most importend you dont need to reprogramm the Transition, a think i realy disliked.
Thank you for your help , i could not done it alone.