Página 1 de 1

TForm:Show() - how to stay focused...?

Publicado: Vie Jun 24, 2022 4:04 pm
por Hurricane
Hi,

In a message-only form(not modal), how to keep focus? prevent clicks on other controls (menus in other windows...). Can something inside the FormShowModal function help me?
I have messageRun( bAction, cMsg ) which works perfectly. Naturally it doesn't use :show() and I have to use {||SomeProcess()}.

Código: Seleccionar todo

METHOD BtnProcessoClick( oSender ) CLASS TFrmEstoque
  // self / this form is modal.
   messageStart( 'Atualização de estoque' ) // this form is not modal
   Sleep(3*1000)
   Process('lendo...') // ProcessMessages()
   Sleep(3*1000)
   Process('lendo 2...')
   Sleep(3*1000)
   messageEnd()
   return nil

function messageStart( cMsg )
   ...
   // osDlg:OnDeactivate :={|o| o:setFocus()}   // SetForegroundWindow // it doesn't help
   // osDlg:OnChangeFocus:={|o| o:setFocus()}  // it doesn't help  
   osDlg:show()
   return nil
regards,

Re: TForm:Show() - how to stay focused...?

Publicado: Lun Jun 27, 2022 8:28 pm
por ignacio
Plus simple:

Código: Seleccionar todo

SetWindowPos( oForm:Handle, HWND_TOPMOST,,,,, nOr( SWP_NOMOVE, SWP_NOSIZE, SWP_NOSENDCHANGING ) )
Regards

Note: Is not exactly what you required, but I guess is what you need. In case not, simply forget it.

Re: TForm:Show() - how to stay focused...?

Publicado: Lun Jul 04, 2022 12:49 pm
por Hurricane
Hi,
Did not work :cry:
but we tried, thank you very much