Ir remote Access to Onclick events

General discussion on Visual TFT Software.
Post Reply
Author
Message
kentar
Posts: 78
Joined: 29 Oct 2010 07:54

Ir remote Access to Onclick events

#1 Post by kentar » 09 Jul 2018 19:32

Hi all .
I have finished a vtft project for stm32 .
It is only one screen and some buttons.
I want to add ir remote control commands via a nec protocol telecontrol.
In main loop i get Ir remote commands . IR is working fine .
I want to link ir command to an onclick event of a button.
How i can do it ?

hexreader
Posts: 1786
Joined: 27 Jun 2010 12:07
Location: England

Re: Ir remote Access to Onclick events

#2 Post by hexreader » 10 Jul 2018 23:47

You do not say which compiler you are using. I only know how to do it in C.

Let's say that you program is called IRint...

The button should already be associated with an on-click event - that you will have given a name - say Action1

In the file IRint_events_code.c you will find functions for these events something like this:

Code: Select all

#include "IRint_objects.h"
#include "IRint_resources.h"

//--------------------- User code ---------------------//


//----------------- End of User code ------------------//

// Event Handlers
void Action1() {
    Button1.Caption[0] = 0x31;
    Button1.Caption[1] = 0x20;
    DrawButton(&Button1);
}
void Action2() {
    Button1.Caption[0] = 0x32;
    Button1.Caption[1] = 0x20;
    DrawButton(&Button1);
}


All you do to simulate button push is call the appropriate function once your IR message is decoded in main program IRint_main.c.
Something like this:

Code: Select all

      // test code only - remove later                      // volume up on Logik remote
      if(ir_cmd == 0xBF40){
           Action1();
      }
      if(ir_cmd == 0xA25D){                                  // volume down on Logik remote
           Action2();
      }
Job done :)
Start every day with a smile...... (get it over with) :)

kentar
Posts: 78
Joined: 29 Oct 2010 07:54

Re: Ir remote Access to Onclick events

#3 Post by kentar » 11 Jul 2018 04:42

Hi hexreader .
Project is in Mikropascal but I understand your example.
I didnt know that i could call onclick event functions from main program.
Thank you for your help.

Post Reply

Return to “Visual TFT General”