Author Topic: Favourite Icon doesn´t work  (Read 77 times)

qqplayer

  • Sr. Member
  • ****
  • Posts: 230
    • View Profile
Favourite Icon doesn´t work
« on: June 16, 2018, 12:18:51 PM »
Tried to show a "favorite" icon on my layout.

Code: [Select]
::OBJECTS <- {
fav = fe.add_image( "favorite.png", 5, 55, 60, 60 ),
}

OBJECTS.fav.visible = false;

function show_favorite( ttype, var, ttime ) {
 switch ( ttype ) {
  case Transition.ToNewList:
  case Transition.ToNewSelection:
    local inf_fav=fe.game_info(Info.Favourite);
if (inf_fav=="1")
       OBJECTS.fav.visible  = true;
    else
           OBJECTS.fav.visible  = false;
    break;
  }
 return false;
}

fe.add_transition_callback( "show_favorite" );

The thing is the icon only shows "on layout start" and if I change the selected game , shows if I have the previous or the next game selected.
I mean . if I have three games, 1, 2, 3
2 is tag as favourite
If I move to 3 , the favourite icon is showed , same with 1 , but not with 2  :(
Only if I start the f.e. with the 2 game previously selected.

keilmillerjr

  • Sr. Member
  • ****
  • Posts: 480
    • View Profile
Re: Favourite Icon doesn´t work
« Reply #1 on: June 16, 2018, 08:07:25 PM »
If all you want to do is toggle an image, use a magic function and case not favorite return an empty string for image url.

qqplayer

  • Sr. Member
  • ****
  • Posts: 230
    • View Profile
Re: Favourite Icon doesn´t work
« Reply #2 on: June 17, 2018, 03:10:12 AM »
If all you want to do is toggle an image, use a magic function and case not favorite return an empty string for image url.
Example please :)

I`ve tried this but doesnt work for me

http://forum.attractmode.org/index.php?topic=670.0