setleave() on static

This forum is for eXpress++ general support.
Post Reply
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

setleave() on static

#1 Post by c-tec »

Hello,
I try to make a metro like dialog. For showing a menu on the right side when moving the mouse over the right border of the window , I use a inivisible button and o:setenter() to show the dialog. But I would like to close the dialog when the mouse moves outside this dialog. I try it with o:setleave(), but it does not work. Any idea why ?
This is my code:

Code: Select all

Button on the right side:
@ 2,DSIZE_X-5  DCSTATIC SIZE 10,DSIZE_Y-4 PIXEL  COLOR GRA_CLR_DARKBLUE,GRA_CLR_DARKBLUE OBJECT oMenuStatic EVAL {|o|o:setenter({|| xMenu2(getlist,oDialog)})}

xMenu dialog:
DCREAD GUI  OPTIONS GetOptions EVAL {|o|o:setleave({||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}),DC_SetWindowTransparency(o:getHwnd(),100), Sleep(1), o:show(), ShowNewUserWindow2(o)} MODAL PARENT @oDlg

Attached a screenshot.

regards
Rudolf
Attachments
2015-01-11_09h50_21.jpg
2015-01-11_09h50_21.jpg (18.67 KiB) Viewed 10317 times
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: setleave() on static

#2 Post by rdonnay »

I have never heard of setEnter() and setLeave().
Are these new in 2.0?

You could use the xbeM_Enter and xbeM_Leave callbacks. Have you tried this?
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: setleave() on static

#3 Post by c-tec »

Hello Roger,
thank you, I am using 1.9, I think when setenter() works, setleave() should also work. Have you a code snipped for the callback ?
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: setleave() on static

#4 Post by c-tec »

Hello Roger,
the event xbeM_Leave is only called from the pushbuttons on the menu dialog, but not at the dialog window itselve. And :setenter() works, but not :setleave(), it's strange.
regards
Rudolf

Code: Select all

DCREAD GUI  OPTIONS GetOptions EVAL {|o|DC_SetWindowTransparency(o:getHwnd(),100), Sleep(1), o:show(), ShowNewUserWindow2(o)} MODAL PARENT @oDlg HANDLER _checkevent

function _checkevent(nEvent, mp1, mp2, oXbp, oDlg,aGetlist, aRef, lOk)
******************************************************************
if nEvent = xbeM_Leave  //.and. oXbp:isderivedfrom("xbpWindow")
          dcqdebugoff mp1,mp2,oXbp
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: setleave() on static

#5 Post by c-tec »

Hello,
also this does not work, only leaving the Pushbuttons on the dialog calls the event and I get an error.
regards
Rudolf

Code: Select all

DCREAD EVAL {|o|testdlg(o)} MODAL PARENT @oDlg
RETURN .t.

FUNCTION testdlg( oDlg )
******************************************************************
oDlg:drawingarea:setleave({||testleave()})
RETURN nil

function testleave()
******************************************************************
dcqdebugoff "leave!"
return NIL
------------------------------------------------------------------------------
ERROR LOG of "v:\Metro\METRO.exe" Date: 14-01-2015 10:44:05

Xbase++ version : Xbase++ (R) Version 1.90.355
Operating system : Windows Vista 06.01 Build 07600
------------------------------------------------------------------------------
oError:args :
-> VALTYPE: O CLASS: XbpIWindow
-> VALTYPE: N VALUE: 0
-> VALTYPE: N VALUE: 0
-> VALTYPE: N VALUE: 1048598
oError:canDefault : N
oError:canRetry : N
oError:canSubstitute: J
oError:cargo : NIL
oError:description : Parameter has a wrong data type
oError:filename :
oError:genCode : 2
oError:operation : :Motion
oError:osCode : 0
oError:severity : 2
oError:subCode : 1025
oError:subSystem : BASE
oError:thread : 1
oError:tries : 0
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Called from DC_GETLIST:EVENTLOOP(4453)
Called from DC_GETLIST:READGUI(3677)
Called from DC_READGUI(101)
Called from XMENU2(769)
Called from (B)MAINDLG(212)
Called from DC_GETLIST:EVENTLOOP(4453)
Called from DC_GETLIST:READGUI(3677)
Called from DC_READGUI(101)
Called from MAINDLG(228)
Called from (B)TASKBARMENU(1504)
Called from DC_GETLIST:READGUI(3630)
Called from DC_READGUI(101)
Called from TASKBARMENU(1504)
Called from PROG_START(98)
Called from PROGMAIN(36)
Called from MAIN(110)
WorkSpaceList :
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: setleave() on static

#6 Post by rdonnay »

If you give me a sample program that I can compile and run, I will help you with this.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: setleave() on static

#7 Post by Auge_Ohr »

c-tec wrote:Any idea why ?
you will NOT receive Xbase++ Events, like from o:Motion, "outside" XbpDialog.

p.s. Crt might be behind XbpDialog
Attachments
WOCURSOR.ZIP
(936 Bytes) Downloaded 600 times
greetings by OHR
Jimmy

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: setleave() on static

#8 Post by c-tec »

Hello Roger,
problem solved with Jimmys tip, but still strange that setleave() not works, would be much easier.
regards
Rudolf

Code: Select all


FUNCTION xMenu2(aGetlist)
******************************************************************
LOCAL GetList[0], GetOptions,nLine := -10,nBSize := 100,oDlg
LOCAL oMainDlgThread
if !empty(lIsSidemenu)
     return NIL
endif
oMainDlgThread := Thread():new()
lIsSidemenu := .t.
DCGET OPTIONS COLOR GRA_CLR_BLACK SAYWIDTH 0 WINDOWROW 2 WINDOWCOL -300 HIDE BORDER XBPDLG_NO_BORDER NOTITLEBAR  WINDOW HEIGHT DSIZE_Y-200 WINDOW WIDTH 150

@ nLine,10 DCPUSHBUTTONXP SIZE nBSize,nBSize caption chr(39)  FONT "60.FormCommanderA"  PIXEL CONFIG BUCFG10 ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}  COLOR GRA_CLR_WHITE,GRA_CLR_BLACK RADIUS 0
nLine+=150;@ nLine,10   DCPUSHBUTTONXP SIZE nBSize,nBSize caption chr(46)  FONT "60.FormCommanderB"  PIXEL CONFIG BUCFG10 ACTION {||syscontrol()}  COLOR GRA_CLR_WHITE,GRA_CLR_BLACK RADIUS 0
nLine+=150;@ nLine,10   DCPUSHBUTTONXP SIZE nBSize,nBSize caption chr(60)  FONT "60.FormCommanderB"  PIXEL CONFIG BUCFG10 ACTION {||get_berecht()}  COLOR GRA_CLR_WHITE,GRA_CLR_BLACK RADIUS 0
nLine+=150;@ nLine,10   DCPUSHBUTTONXP SIZE nBSize,nBSize caption chr(60)  FONT "60.FormCommanderA"  PIXEL CONFIG BUCFG10 ACTION {||winapiopen("http://www.c-tec.at")}  COLOR GRA_CLR_WHITE,GRA_CLR_BLACK RADIUS 0

DCREAD GUI TIMEOUT 15 TITLE "Menue" OPTIONS GetOptions EVAL {|o|DC_SetWindowTransparency(o:getHwnd(),100), Sleep(1), o:show(), ShowNewUserWindow2(o),o:killDisplayFocus := {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)},oMainDlgThread:Start("CheckMainDlg",o,getlist)} MODAL PARENT @oSidemenuDlg //HANDLER _checkevent
oSidemenuDlg := NIL
lIsSidemenu := .f.
RETURN .t.

FUNCTION CheckMainDlg(oMain,aGetlist)
******************************************************************
LOCAL nEvent, mp1, mp2, oXbp
LOCAL aCheck := {0,0}
LOCAL aPos   := {0,0}
LOCAL aSize  := {0,0}
LOCAL oThread := ThreadObject()
nEvent := 0
DO WHILE lIsSidemenu
     nEvent := AppEvent( @mp1, @mp2, @oXbp,100 )
     DO CASE
          CASE nEvent = xbe_None
               aCheck := GetCursorPos()
               aPos   := oMain:CurrentPos()
               aSize  := oMain:CurrentSize()
               IF aCheck[1] < aPos[1]          .OR. ;
                    aCheck[1] > aPos[1]+aSize[1] .OR. ;
                    aCheck[2] < aPos[2]          .OR. ;
                    aCheck[2] > aPos[2]+aSize[2]
                    DC_ReadGuiEvent(DCGUI_EXIT_ABORT,aGetList)
                    lIsSidemenu := .f.
                    //dcqdebugoff "----------- oustsid -------------------"
               ENDIF
          CASE nEvent = xbeM_Motion

          OTHERWISE
          oXbp:handleEvent( nEvent, mp1, mp2 )
     ENDCASE
ENDDO
oThread:quit()
oThread:setInterval(NIL)
oThread := NIL
RETURN NIL
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply