FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour drag zone on window without title
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
drag zone on window without title
Posted: Sat Dec 08, 2007 04:55 PM
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


Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
drag zone on window without title
Posted: Sat Dec 08, 2007 06:44 PM

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. }

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
drag zone on window without title
Posted: Sat Dec 08, 2007 08:14 PM
Otto,

Here you have a working sample:
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
drag zone on window without title
Posted: Sat Dec 08, 2007 08:54 PM

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 )

//----------------------------------------------------------------------------//

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
drag zone on window without title
Posted: Sun Dec 09, 2007 09:19 AM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
drag zone on window without title
Posted: Sun Dec 09, 2007 10:19 AM

Antonio, which one do you mean?
Thanks in advance
Otto

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
drag zone on window without title
Posted: Sun Dec 09, 2007 11:56 AM
Otto,

Here you have it:
#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 ) 

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM
drag zone on window without title
Posted: Sun Dec 09, 2007 12:48 PM

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?

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
drag zone on window without title
Posted: Sun Dec 09, 2007 02:32 PM

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 :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion