web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / set focus on a other c...
Power Apps
Answered

set focus on a other control not working?

(0) ShareShare
ReportReport
Posted on by 997

Hello,

I was wondering how i can set focus on a other control
Yes i know with

 

Setfocus(a control)

 

But seems not working
I set this on my TextInput control

 

Reset(Self);;Reset(Gallery2);;Set(var_Gallery2;false);;Reset(Timer_Search)

 

the timer on start and autostart
OnTimerStart

 

Set(var_Gallery2;false)

 

OnTimerEnd

 

Reset(Gallery2);;
Set(var_Gallery2;true);;
SetFocus(Button1)

OnAutoStart

If(CountRows(Gallery2.AllItems)>0;true;false)

 

But focus isn't working
I have my button and other controls
In screen2

TimmyBoy_0-1708806734435.png

So the Gallery is in a other container
Just like the Button1, the timer is on the screen 2

TimmyBoy_1-1708806805807.png

Any help please
Thank you

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,026 Most Valuable Professional on at

    It looks like the timer autostart is set to false initially, so what event starts the timer? From the code you've shown I don't think the timer ever runs, so the SetFocus never executes.

  • TimmyBoy Profile Picture
    997 on at

    Hi @Pstork1 
    Whoops, my fault
    I forgot the code of the autostart

    If(CountRows(Gallery2.AllItems)>0;true;false)

    So when i type something in my TextInput control
    And it match some data on the hidden gallery
    the Autostart of the timer will run

  • Verified answer
    Pstork1 Profile Picture
    69,026 Most Valuable Professional on at

    If you temporarily add a button to the same container as the timer and set it to SetFocus(Button1) does the focus go where you want it to when you press the button? If yes, then its something in the timer code, if no, then its something about the setFocus(). As long as the containers are on the same screen it shouldn't matter. 

    Two other thoughts:

    1) Did you check the container to make sure that EnableChildFocus is set to True

    2) Button1 is just in a container and not in a gallery correct?

  • TimmyBoy Profile Picture
    997 on at

    Hi @Pstork1 

    Guess it's my fault 🙄
    The button1 can't be hidden if you want to add the focus
    I added a new button at the same location of the timer as you provided
    And that worked.
    Thank you.
    So we known that for in the future 😉 

  • Pstork1 Profile Picture
    69,026 Most Valuable Professional on at

    Since setting the focus is all about input it makes sense that you can't set focus to a control that can't be seen or that is read only. Glad you solved the issue.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 531 Most Valuable Professional

#2
Haque Profile Picture

Haque 261

#3
Kalathiya Profile Picture

Kalathiya 221 Super User 2026 Season 1

Last 30 days Overall leaderboard