Page 1 of 1
Focus problem
Posted: Wed May 28, 2025 1:37 pm
by oliveiros junior
Hello, good morning!
Friends, I have the following problem: I leave an application/screen open, e.g. file explorer, I enter my application and perform several actions, and suddenly when I return to a screen, instead of returning the focus to my application, the focus goes to the open application/screen. Has anyone experienced this or knows how to solve it?
I appreciate any guidance in advance.
Kind regards,
Oliveiros Junior
Re: Focus problem
Posted: Wed May 28, 2025 3:03 pm
by karinha
No entendí. ¿Podrías publicar el código para que lo entiendas mejor?
I didn't understand. Can you post some code for better understanding?
Gracias, tks.
Regards, saludos.
Re: Focus problem
Posted: Wed May 28, 2025 3:11 pm
by oliveiros junior
Olá Karinha,
É o seguinte: Abro o explorador de arquivos e deixo ele aberto, depois abro outra aba e executo meu aplicativo, ele fica aberto e o explorador de arquivos está aberto atrás. Até aí tudo bem. Começo a utilizar minha aplicação, abro algumas tela e sem mais nem menos, ao invés de retornar a tela anterior da minha aplicação com o devido foco, ele mostra o explorador de arquivos, com o foco sobre ele.
Att.,
Oliveiros Junior
Re: Focus problem
Posted: Wed May 28, 2025 3:44 pm
by karinha
Como é o seu MENU PRINCIPAL? Mostre alguma coisa que nos dê uma PISTA, pls.
Gracias, tks.
Regards, saludos.
Re: Focus problem
Posted: Wed May 28, 2025 4:35 pm
by Antonio Linares
Dear Oliveiros,
Please post some screenshots, thank you
Re: Focus problem
Posted: Wed May 28, 2025 5:12 pm
by karinha
Oliveiros, ¿tienes algún programa ejecutándose en la bandeja de Windows en segundo plano que pueda desviar la atención de tu sistema?
Oliveiros, do you have any programs running in the Windows tray in the background that could take focus away from your system?
Gracias, tks.
Regards, saludos.
Re: Focus problem
Posted: Wed May 28, 2025 5:17 pm
by Giovany Vecchi
Hi Oliveiros.
This usually happens when we open an MDI window and after we close the MDI window any open Windows program overwrites the program.
To solve the problem I do this:
Code: Select all | Expand
TIME_FUNCTION({||BringWindowToTop( lc_oDlg:hWnd ),;
SendMessage(lc_oDlg:hWnd,WM_SETFOCUS,0,0)},.2)
///////////////////////////////////////////////////////////////////////////
FUNCTION TIME_FUNCTION(f_CodeBlock, f_nTempo)
Local _oTempo
Default f_nTempo := 3
f_nTempo := f_nTempo*1000
Define timer _oTempo interval f_nTempo of WndMain() ;
action { _oTempo:DeActivate(),;
Eval(f_CodeBlock),;
_oTempo:DeActivate(),_oTempo:end()}
Activate timer _oTempo
return NIL
Re: Focus problem
Posted: Wed May 28, 2025 8:09 pm
by oliveiros junior
Olá,
Vou tentar a solução do Giovany e comento aqui se resolveu.
Obrigado!