Home AMX User Forum AMX Control Products

Change TP Palette dynamically in code

Hi All,

Does anyone know of a command that exists to select a TP palette in code (G4 and G5 panels)? I know you can switch and select the active palette through TPD directly but I'd like to dynamically set the active palette in code. I've searched through AMX-PI and can't find a command for this so I'm assuming one doesn't exist. Thought I'd check though. Seems like something that would be useful to have...

Thanks!

Comments

  • davidgdavidg Posts: 16
    Anyone? Bueller?
  • I had the same question a number of years back - your discovery is correct, no palette commands. My recollection is that the palettes are an asset available only at the development level in the application. I wish it weren't so, (can't speak as to the G5's as I haven't had the opportunity to mess with one). I dug up the post for reference, there are some interesting ideas in there that may help.

    http://www.amxforums.com/forum/technical-forum/amx-user-interfaces/4788-touchpanel-themes
  • davidgdavidg Posts: 16
    Thanks Larry! I really wish this were possible but looks like I'll have to make due without it. Wanted to give my client the ability to quickly change around color schemes via palettes with a quick NetLinx command but alas, it was not meant to be. Feature request!
  • John NagyJohn Nagy Posts: 1,734
    You can (in G4) easily and quickly change colors, borders, fills, transparency, by sending parameters to buttons and backgrounds. G5, not so much on the color or borders.
    We pack 24 radically different themes in every panel, user select-able or by preset user preferences. To ship an entire panel with hundreds of pages/pops (every button, background, page, and pop) from one theme to another takes only about 5 seconds on an old G4 and TPControl, 2 on an XG4. You don't have to do it by palette. We just riff through a lookup table with the addresses and send them by range when possible, and singly when not.

    Here's the same page, same panel, seconds apart.
    Well, I see the first one is from a different build batch, but you get the idea.
  • davidgdavidg Posts: 16
    Thanks John! Yes, I'm aware of the ability to change the button properties dynamically as you suggested. For this particular application, I was looking for a single command to switch between palettes rather than creating lookup tables and sending multiple commands to lots of buttons, etc. Plus I have a mix of G4 and G5 so I wanted a quick, universal "works on everything" solution.

    Not a huge deal but I just figured since I already have the palettes set up, why not make use of them, you know?
  • viningvining Posts: 4,368
    I used to do this too and it is quite simple once you're done with the coding. I also had backgrounds whose xy posit had to change in various pop ups depending on the res of the TP which was the biggest pain in the a$$ since the res's are all over the place which is also why I hate making TP pages for AMX panels, create a theme and then you need to make 6 variations of it, re-sizing buttons and graphics, etc. To track the res I get the dev id of the TPs when they come online and compare that to a look up table for the res for that dev id and populates a tp res array, etc....

    Here's a snippet for an example:
    SWITCH(sUI[iUI_Indx].nResolution)
               {
               CASE UI_RESI_1280x768://17" 1280 X 768 SCREEN
                {//CB = btn border, CF = btn fill, CT = txt color, EC = txt effect color, JB = bitmap justification, P = bitmap filename
                //main buttons
                SEND_COMMAND dvUI_Arry[iUI_Indx].NUMBER:5:0,"'^BMF-299,0,%CB',BG_BTN_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CF',BG_FILL_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CT',BG_TXT_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%EC',BG_TXT_EFF_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd]";
                                     //'%JB0 -156,-225',
                                     //'%P'";
                                     //,BG_PIC_ARRY[sUI[iUI_Indx].nBkGrnd]";
                
                //back ground changer     
                SEND_COMMAND dvUI_Arry[iUI_Indx],"'^BMF-321,1,%CB',BG_BTN_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CF',BG_FILL_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CT',BG_TXT_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%EC',BG_TXT_EFF_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%JB0 -250,-692',
                                     '%P',BG_PIC_ARRY[sUI[iUI_Indx].nBkGrnd]";
                                     
                //main page
                SEND_COMMAND dvUI_Arry[iUI_Indx],"'^BMF-320,1,%CB',BG_BTN_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CF',BG_FILL_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CT',BG_TXT_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%EC',BG_TXT_EFF_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%JB0 0,0',
                                     '%P',BG_PIC_ARRY[sUI[iUI_Indx].nBkGrnd]";
                                     
                (*//caller ID log
                SEND_COMMAND dvUI_Arry[iUI_Indx],"'^BMF-319,1,%CB',BG_BTN_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CF',BG_FILL_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CT',BG_TXT_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%EC',BG_TXT_EFF_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%JB0 -250,-8',
                                     '%P',BG_PIC_ARRY[sUI[iUI_Indx].nBkGrnd]";
                                     
                *)//utilities
                SEND_COMMAND dvUI_Arry[iUI_Indx],"'^BMF-318,0,%CB',BG_BTN_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CF',BG_FILL_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CT',BG_TXT_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%EC',BG_TXT_EFF_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%JB0 -1041,-6',
                                     '%P',BG_PIC_ARRY[sUI[iUI_Indx].nBkGrnd]";
                
                //EPC Select  change offsets for res
                SEND_COMMAND dvUI_Arry[iUI_Indx],"'^BMF-319,0,%CB',BG_BTN_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CF',BG_FILL_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%CT',BG_TXT_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%EC',BG_TXT_EFF_COLOR_ARRY[sUI[iUI_Indx].nBkGrnd],
                                     '%JB0 -156,-206',
                                     '%P',BG_PIC_ARRY[sUI[iUI_Indx].nBkGrnd]";
                                     
    
    continued ......
    
Sign In or Register to comment.