FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Find a dialog
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Find a dialog
Posted: Tue Jan 02, 2018 10:29 PM

Is there a way to find a dialog which is active. It is a resource dialog and was Activated with "NOMODAL"

I would like to detect if it is on the screen somewhere and close it if need be.

Thanks,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Find a dialog
Posted: Tue Jan 02, 2018 10:52 PM
You know cTitle / cCaption of dialog?

if you know cCaption, sample

Code (fw): Select all Collapse
//----------------------------------------------------------------------------//
//
Function BuscaDialog( cTitle )

   local nAt  := Ascan( GetAllWin(), { | w | Upper( w:cCaption ) == Upper( cTitle ) } )
   if !Empty( nAt )
      ? nAt, GetAllWin()[ nAt ]:ClassName()
   endif
   // XBrowse( GetAllWin() )

Return nil
//
//----------------------------------------------------------------------------//
Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: Find a dialog
Posted: Tue Jan 02, 2018 11:15 PM

I came up with this:

Function FW_FindWindow( cTitle,cClassName )
Local aWindows := GetAllWin()
Local oRv := nil
Local o := nil
For Each o in aWindows
If o:ClassName() == cClassName
If o:cTitle == cTitle
oRv := o
Exit
Endif
Endif
Next
Return oRv

If there is a better way please let me know.

Thanks,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: Find a dialog
Posted: Tue Jan 02, 2018 11:18 PM

Yes Mr. Navarro,

I believe you posted it before I finished mine.

I like your way better.

Thanks,

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services

Continue the discussion