drag zone on window without title

drag zone on window without title

Postby Otto » Sat Dec 08, 2007 4: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


Image
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Sat Dec 08, 2007 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Dec 08, 2007 8:14 pm

Otto,

Here you have a working sample:
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Sat Dec 08, 2007 8: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 )

//----------------------------------------------------------------------------//
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Sun Dec 09, 2007 9: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Sun Dec 09, 2007 10:19 am

Antonio, which one do you mean?
Thanks in advance
Otto
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Sun Dec 09, 2007 11:56 am

Otto,

Here you have it:
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » 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?
User avatar
Otto
 
Posts: 6327
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Sun Dec 09, 2007 2: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42079
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 94 guests