Skip to main content
Chandan Bhatia1
Associate III
April 28, 2020
Solved

Touchgfx change complete screen during run time and customized widget creation

  • April 28, 2020
  • 1 reply
  • 8387 views

Hello, I and using Touchgfx in my project. I want to implement below.

1) During run time , I want to to turn off complete screen.

2) During run time , I want to change complete screen.

3) I want to generate QR code dynamically and also want to clear it sometimes during run time. I got github link and added those files in my project. Still I am not sure how to call it. You have mentioned to call qrCode.setXY(0,0) , qrCode.setQRCode(&code), qrCode.setScale(4) , add(qrCode) methods but I am unable to find it.

Can any one please help ?

Best answer by Martin KJELDSEN

1) Seems like a hardware thing.

2) Change screens at run-time with interactions in the designer.

3) QRCodeWidget inherits from Widget which has setXY() and your view has add(). setQRCode() and setScale() are declared in QRCodeWidget.hpp. It's all there on github.

class QRCodeWidget : public touchgfx::Widget
{
...
 /**
 * @fn void QRCodeWidget::setQRCode(QRCode *code);
 *
 * @brief Set the qr code to display
 */
 void setQRCode(QRCode *code);
 
 /**
 * @fn void QRCodeWidget::setScale(uint8_t s);
 *
 * @brief Set the scaling factor of the widget
 */
 void setScale(uint8_t s);
...
}

 To summarize. If you're looking at the README.md for QR code, then:

qrCode.setXY(0,0); //From widget
qrCode.setQRCode(&code); //From QRCodeWidget
qrCode.setScale(4); //From QRCodeWidget
add(qrCode); //Add to root container of your screen (view)

1 reply

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
April 28, 2020

1) Seems like a hardware thing.

2) Change screens at run-time with interactions in the designer.

3) QRCodeWidget inherits from Widget which has setXY() and your view has add(). setQRCode() and setScale() are declared in QRCodeWidget.hpp. It's all there on github.

class QRCodeWidget : public touchgfx::Widget
{
...
 /**
 * @fn void QRCodeWidget::setQRCode(QRCode *code);
 *
 * @brief Set the qr code to display
 */
 void setQRCode(QRCode *code);
 
 /**
 * @fn void QRCodeWidget::setScale(uint8_t s);
 *
 * @brief Set the scaling factor of the widget
 */
 void setScale(uint8_t s);
...
}

 To summarize. If you're looking at the README.md for QR code, then:

qrCode.setXY(0,0); //From widget
qrCode.setQRCode(&code); //From QRCodeWidget
qrCode.setScale(4); //From QRCodeWidget
add(qrCode); //Add to root container of your screen (view)

Chandan Bhatia1
Associate III
April 28, 2020

Thanks for reply. I am looking to know where should i put below? In main ?

qrCode.setXY(0,0); //From widget
qrCode.setQRCode(&code); //From QRCodeWidget
qrCode.setScale(4); //From QRCodeWidget
add(qrCode); //Add to root container of your screen (view)

Also Regarding turn off complete screen during run time, will be able to suggest which hardware changes I need to do ?

Martin KJELDSEN
Principal III
April 28, 2020

This code goes into setupScreen() of your view. Remember to declare qrCode in the view headerfile .

/Martin