FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour End dialogue when lost focus
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
End dialogue when lost focus
Posted: Wed Dec 01, 2021 03:36 AM
Code (fw): Select all Collapse
     DEFINE DIALOG oDlg FROM 0,0 TO nDlgHei, nDlgWid                ;
        STYLE nOr(WS_POPUP, WS_VISIBLE) ;
        COLOR CLR_BLACK, nRgb(255,255,238) ;
        TRANSPARENT ;
        FONT oFnt PIXEL

 ACTIVATE DIALOG oDlg NOWAIT CENTERED                                  ;
        ON INIT oDlg:bLostFocus := {|| oDlg:end()}


I expect this code to end the dialogue box if I click anywhere outside the dialogue box but it doesn't.
Why?

TIA
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: End dialogue when lost focus
Posted: Wed Dec 01, 2021 04:19 PM

ACTIVATE DIALOG oDlg NOWAIT CENTERED ;
ON INIT oDlg:bNcActivate:={|lOnOff|iif(lOnOff,, oDlg:End())}

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: End dialogue when lost focus
Posted: Wed Dec 01, 2021 07:55 PM
Code (fw): Select all Collapse
#include "Fivewin.ch"

Function Main()

   local oDlg

     DEFINE DIALOG oDlg FROM 0,0 TO 300, 600               ;
        STYLE WS_POPUP ;
        COLOR CLR_BLACK, nRgb(255,255,238) ;
        PIXEL TRUEPIXEL TRANSPARENT 

     oDlg:bLostFocus := {|| oDlg:end()}
     ACTIVATE DIALOG oDlg /*NOWAIT*/ CENTERED

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: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: End dialogue when lost focus
Posted: Thu Dec 02, 2021 02:18 AM

Thanks Natter and Cristobal.
I got the effect that I want by including oDlg:bNcActivate := {| lOnOff | iif (lOnOff ,, oDlg: End ())}

Once that's included I could remove the NOWAIT clause

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: End dialogue when lost focus
Posted: Thu Dec 02, 2021 02:44 AM
To continue, I tie the code to display the dialog box to xBrowse's right click,
Code (fw): Select all Collapse
 :aCols[4]:bRClickData := {||  ud_msginfo( cDescription) }
.

Now if I right click a row on xBrowse, the dialogue appears with the message. If I left-click anywhere outside the dialogue, it is closed. Perfect.

But if when the dialogue appears and I immediately right click on a different row, I wish the current dialogue box is closed and reshown with message of the new row, how to achieve that? Now the 2st right click opens the dialog, 2nd right click closes it, at 3rd right click only will it reopens the dialgue box

TIA
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour

Continue the discussion