Layout With background and Text

Everything regarding the Power-Grid SDK can be asked and discussed here.

Layout With background and Text

Postby blackfire49 » 13. Jan 2016, 20:33

Hello Community

I wanna make my own buttons but don't know what to use for a Button with Background and Text.

In the Plugin Building Guide it says something about Type:"Button" but in the example a command says
// Available types: "Skin", "Text", "Input", "Gfx"

So now my Question:

Can i use Type:"Button" and if i can how do i use Param:"" to add a image and if not what for a Type sould i use??

Thats how my plugin.json looks like but no Button is showing
Code: Select all
{
   Name:"ButtonPlugin",
   
   CtrlSets:["ButtonPlugin.ctrlset.json"],
   
   Scripts:[
      {
         Name:"ButtonPluginScript",
         // Enter the supported functions here
         Functions:[
            "button_red", // called when input layout is updated
                        // (see below)
            
         ],
         // This is the filename for the script
         Rsc:"ButtonPlugin.qs"
      }
      
   ],
   
   Gfxs:[
      {
         Name:"button_red_off",
         Rsc:"Buttons/myredtoggleoff.png",
      },
      {
         Name:"button_red_on",
         Rsc:"Buttons/myredtoggleon.png",
      },
   ],
   
   
   Skins:[
      {
         Name:"ButtonRedSkin",
         Layouts:[
            {
               Name:"ButtonRedSkin",
               // Available types: "Skin", "Text", "Input", "Gfx"
               // TODO: explain 'Skin nesting'
               Type:"Button",
               Param: "type=image;image=button_red_off",
               // Javascript method to be called on entering text
               // (per character!)
               OnMousePress:"button_red",
               
               Left:0,
               Top:0,
               Width:160,
               Height:160
            }
         ]
      }
   ],
   
   Controls:[
      {
         Name:"button_red_Control",
         Skins:["ButtonRedSkin"],
         Config:{
            Description:"A red Button"
         }
      },
   ],
}
blackfire49
 
Posts: 2
Joined: 18. Jun 2015, 18:24

Re: Layout With background and Text

Postby Addihash » 15. Jan 2016, 15:11

There is no type 'Button' thats why our control deosn't show up.

You can however layer multiple layouts, eg:

Code: Select all
Skins:[
      {
         Name:"ButtonRedSkin",
         Layouts:[
            {
               Name:"ButtonRedSkinBackground",
               Type:"Gfx",
               OnMousePress:"button_red",
               Gfx:"button_red_off",
               GfxP:"button_red_on",
               Left:0,
               Top:0,
               Width:160,
               Height:160
            },
            {
               Name:"ButtonRedSkinText"
               Type:"Text",
               Text:"My Text",
               Left:0,
               Top:0,
               Width:160,
               Height:160
            }
         ]
      }
   ],
Addihash
Administrator
 
Posts: 232
Joined: 2. Feb 2015, 14:35


Return to Power-Grid SDK

Who is online

Users browsing this forum: No registered users and 1 guest