Reset button ids to default ids
#1
Hi guys
I need your help, I'm trying to reset the buttons id to default ids when I remove the controls and re-add the controls.

When I add the button controls, I will get the list of buttons id that would always start with 3002 until to 3484.

Like this:

Code:
00:51:31 T:5500  NOTICE: [3002, 3003, 3004....etc until to 3484]


When I use this to remove the controls:

Code:
def All_Channels_BACKUP(self):
...etc
    program_controls = xbmcgui.ControlButton(
        int(position_start),
        int(position_top),
        int(program_width),
        int(program_height),
        program_title,
        focusTexture = path + self.button_focus,
        noFocusTexture = path + self.button_nofocus,
        textColor ='0xFFFFFFFF',
        focusedColor ='0xFF000000'
    )
self.program_buttons.append(ProgramControls(program_controls, program))

#add the programs buttons
self.addControls(programs_button)


def Remove_buttons(self):
         RemoveButtons = [elem.control for elem in self.program_buttons]
         self.setFocus(self.program_buttons[0].control)
         try:
             self.removeControls(RemoveButtons)
         except RuntimeError:
             for elem in self.program_buttons:
                 try:
                     self.removeControl(elem.control)
                 except RuntimeError:
                     pass # happens if we try to remove a control that doesn't exist
         del self.program_buttons[:]
         del RemoveButtons


So when i re-add the button controls, I will get different ids that would start with 3487 until to 3969.

Like this

Code:
00:52:02 T:6688  NOTICE: [3487, 3488, 3489....etc until to 3969]


Can you please help me how I can reset the button ids in each time when I remove the button controls?
Reply

Logout Mark Read Team Forum Stats Members Help
Reset button ids to default ids0