Find a dialog

Find a dialog

Postby byron.hopp » 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
byron.hopp
 
Posts: 381
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Find a dialog

Postby cnavarro » Tue Jan 02, 2018 10:52 pm

You know cTitle / cCaption of dialog?

if you know cCaption, sample

Code: Select all  Expand view


//----------------------------------------------------------------------------//
//
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
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Find a dialog

Postby byron.hopp » 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
byron.hopp
 
Posts: 381
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA

Re: Find a dialog

Postby byron.hopp » 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
byron.hopp
 
Posts: 381
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 39 guests

cron