pub fn request_focus(&mut self, entity: impl Into<Entity>, ctx: &mut Context) {
        let entity = entity.into();

        if (self.focused_entity.is_some() && self.focused_entity.unwrap() == entity)
            || !*ctx.get_widget(entity).get::<bool>("enabled")
        {
            return;
        }

        if let Some(old_focused_element) = self.focused_entity {
            let mut old_focused_element = ctx.get_widget(old_focused_element);

            old_focused_element.set("focused", false);
            old_focused_element
                .get_mut::<Selector>("selector")
                .remove_all_similar_states("focused");
            old_focused_element.update(false);
        }

        self.focused_entity = Some(entity);

        if ctx.get_widget(entity).has::<bool>("focused") {
            let mut focused_element = ctx.get_widget(entity);

            focused_element.set("focused", true);
            focused_element
                .get_mut::<Selector>("selector")
                .push_state("focused");
            focused_element.update(false);
        }
    }
/// Request focus for the given entity.
Request focus for the given entity.
Request focus for the given entity .
pub fn request_focus(&mut self, entity: impl Into<Entity>, ctx: &mut Context) {
        let entity = entity.into();
        if (self.focused_entity.is_some() && self.focused_entity.unwrap() == entity)
            || !*ctx.get_widget(entity).get::<bool>("enabled")
        {
            return;
        }
        if let Some(old_focused_element) = self.focused_entity {
            let mut old_focused_element = ctx.get_widget(old_focused_element);
            old_focused_element.set("focused", false);
            old_focused_element
                .get_mut::<Selector>("selector")
                .remove_all_similar_states("focused");
            old_focused_element.update(false);
        }
        self.focused_entity = Some(entity);
        if ctx.get_widget(entity).has::<bool>("focused") {
            let mut focused_element = ctx.get_widget(entity);
            focused_element.set("focused", true);
            focused_element
                .get_mut::<Selector>("selector")
                .push_state("focused");
            focused_element.update(false);
        }
    }
pub fn request_focus ( & mut self , entity : impl Into < Entity > , ctx : & mut Context ) { let entity = entity . into ( ) ; if ( self . focused_entity . is_some ( ) && self . focused_entity . unwrap ( ) == entity ) || ! * ctx . get_widget ( entity ) . get :: < bool > ( " " ) { return ; } if let Some ( old_focused_element ) = self . focused_entity { let mut old_focused_element = ctx . get_widget ( old_focused_element ) ; old_focused_element . set ( " " , false ) ; old_focused_element . get_mut :: < Selector > ( " " ) . remove_all_similar_states ( " " ) ; old_focused_element . update ( false ) ; } self . focused_entity = Some ( entity ) ; if ctx . get_widget ( entity ) . has :: < bool > ( " " ) { let mut focused_element = ctx . get_widget ( entity ) ; focused_element . set ( " " , true ) ; focused_element . get_mut :: < Selector > ( " " ) . push_state ( " " ) ; focused_element . update ( false ) ; } }
Request focus for the given entity.
Request focus for the given entity .
&mut self
entity
impl Into<Entity>
ctx
&mut Context