Page 1 of 1
drag zone on window without title
Posted: Sat Dec 08, 2007 4:55 pm
by Otto
In this application I can drag the window from everywhere on the red zone.
Does someone know how to do this?
Thanks in advance
Otto
Posted: Sat Dec 08, 2007 6:44 pm
by Antonio Linares
Otto,
You have to use bLClicked to set a lDrag variable to .T., then use bMMoved to move the window and finally bLButtonUp to set the lDrag to .F.
oWnd:bLClicked = { || lDrag := .T. }
oWnd:bMMoved = { |nRow, nCol | If( lDrag, oWnd:Move( nRow, nCol ),) }
oWnd:bLButtonUp = { || lDrag := .F. }
Posted: Sat Dec 08, 2007 8:14 pm
by Antonio Linares
Otto,
Here you have a working sample:
Code: Select all
#include "FiveWin.ch"
function Main()
local oWnd, nRowPos, nColPos, lDrag := .F.
DEFINE WINDOW oWnd STYLE WS_POPUP COLOR "W/R"
oWnd:bLClicked := { | nRow, nCol | nRowPos := nRow, nColPos := nCol, lDrag := .T. }
oWnd:bMMoved = { | nRow, nCol | If( lDrag, oWnd:Move( oWnd:nTop + nRow - nRowPos,;
oWnd:nLeft + nCol - nColPos ),) }
oWnd:bLButtonUp := { || lDrag := .F. }
ACTIVATE WINDOW oWnd
return nil
Posted: Sat Dec 08, 2007 8:54 pm
by Otto
Hello Antonio,
thank you for your help.
Could you please have another look.
I would need this for MDI windows.
The ECR prints to the screen and there can be many receipts at one time.
The cook can with a touch screen sort the receipts and click crossed out the meals he so far has prepared.
A timer watch the directory and brings up the receipt to the screen. First all the meal are announced with Playsound() – thanks to you it is working .
It would be nice if the zone to drag the receipts would be bigger than the title because you have to use your fingers.
#include "FiveWin.ch"
#include "InKey.ch"
#include "xbrowse.ch"
static oWnd
static nTop:=0
//----------------------------------------------------------------------------//
function Main()
local oBar
DEFINE WINDOW oWnd MDI ;
TITLE "Küchenmeister"
DEFINE BUTTONBAR oBar 3D OF oWnd
DEFINE BUTTON OF oBar ACTION CustomerBrowse()
// SET MESSAGE OF oWnd TO "FiveWin xBase power!" CENTERED
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
//----------------------------------------------------------------------------//
function CustomerBrowse()
local oWndChild, oBrw
local cAlias
local nRowPos, nColPos, lDrag := .F.
USE Customer NEW ALIAS ( cAlias := GetNewAlias( "CUST" ) ) SHARED
DEFINE WINDOW oWnd ChildSTYLE MDICHILD TITLE Alias() // WS_POPUP COLOR "W/R"
oBrw := TXBrowse():New( oWndChild )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:SetRDD()
oBrw:CreateFromCode()
// oWndChild:oClient := oBrw
oWndChild:bLClicked := { | nRow, nCol | nRowPos := nRow, nColPos := nCol, lDrag := .T. }
oWndChild:bMMoved = { | nRow, nCol | If( lDrag, oWndChild:Move( oWndChild:nTop + nRow - nRowPos,;
oWndChild:nLeft + nCol - nColPos ),) }
oWndChild:bLButtonUp := { || lDrag := .F. }
return nil
// oWndChild:Center()
ACTIVATE WINDOW oWndChild ON INIT (oWndChild:nLeft(320),oWndChild:nTop(nTop*20),oWndChild:nWidth(250), oBrw:SetFocus())
return nil
//----------------------------------------------------------------------------//
function GetNewAlias( cDbfName )
static n := 0
nTop:=n
return cDbfName + StrZero( ++n, 2 )
//----------------------------------------------------------------------------//
Posted: Sun Dec 09, 2007 9:19 am
by Antonio Linares
Otto,
> It would be nice if the zone to drag the receipts would be bigger than the title because you have to use your fingers.
Please post a screenshot, thanks
BTW, your proposed example fails to properly run. Please check it before posting it
Posted: Sun Dec 09, 2007 10:19 am
by Otto
Antonio, which one do you mean?
Thanks in advance
Otto
Posted: Sun Dec 09, 2007 11:56 am
by Antonio Linares
Otto,
Here you have it:
Code: Select all
#include "FiveWin.ch"
#include "InKey.ch"
#include "xbrowse.ch"
static nTop:=0
//----------------------------------------------------------------------------//
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd MDI ;
TITLE "Küchenmeister"
DEFINE BUTTONBAR oBar 3D OF oWnd
DEFINE BUTTON OF oBar ACTION CustomerBrowse()
// SET MESSAGE OF oWnd TO "FiveWin xBase power!" CENTERED
ACTIVATE WINDOW oWnd MAXIMIZED
return nil
//----------------------------------------------------------------------------//
function CustomerBrowse()
local oWnd, oBrw
local cAlias
local nRowPos, nColPos, lDrag := .F.
USE Customer NEW ALIAS ( cAlias := GetNewAlias( "CUST" ) ) SHARED
DEFINE WINDOW oWnd MDICHILD TITLE Alias() // WS_POPUP COLOR "W/R"
oBrw := TXBrowse():New( oWnd )
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:nColDividerStyle := LINESTYLE_BLACK
oBrw:lColDividerComplete := .t.
oBrw:SetRDD()
oBrw:CreateFromCode()
// oWndChild:oClient := oBrw
oWnd:bLClicked := { | nRow, nCol | nRowPos := nRow, nColPos := nCol, lDrag := .T. }
oWnd:bMMoved = { | nRow, nCol | If( lDrag, oWnd:Move( oWnd:nTop + nRow - nRowPos,;
oWnd:nLeft + nCol - nColPos,,, .T. ),) }
oWnd:bLButtonUp := { || lDrag := .F. }
ACTIVATE WINDOW oWnd ON INIT (oWnd:nLeft(320),oWnd:nTop(nTop*20),oWnd:nWidth(250), oBrw:SetFocus())
return nil
//----------------------------------------------------------------------------//
function GetNewAlias( cDbfName )
static n := 0
nTop:=n
return cDbfName + StrZero( ++n, 2 )
//----------------------------------------------------------------------------//
Posted: Sun Dec 09, 2007 12:48 pm
by Otto
Antonio, thank you very much.
Now I start the finishing.
Regards,
Otto
PS: I helped Ruth to set up a portal for our codesnips project. Ruth placed the FW logo on it.
Is it OK for you?
Posted: Sun Dec 09, 2007 2:32 pm
by Antonio Linares
Otto,
>
PS: I helped Ruth to set up a portal for our codesnips project. Ruth placed the FW logo on it. Is it OK for you?
>
Yes, its fine, you are welcome