Dear All,
I would like to make slide to unlock the lock screen on touch screen.
How to do it or any example?
Thanks in advance,
#include "FiveWin.ch"
function Main()
local oWnd, oCursor, oBar, oBtn, nMCol
DEFINE WINDOW oWnd
DEFINE CURSOR oCursor HAND
DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007
oWnd:oTop = nil
oWnd:oBar = nil
oBar:nTop = 80
oBar:nLeft = 50
oBar:nWidth -= 100
@ 0, 0 BTNBMP oBtn OF oBar SIZE 60, 60 ACTION MsgInfo( "ok" )
oBtn:oDragCursor = oCursor
oBtn:bLClicked = { | nRow, nCol | nMCol := nCol, oBtn:lPressed := .T. }
oBtn:bMMoved = { | nRow, nCol | If( oBtn:lPressed, If( oBtn:nLeft + nCol - nMCol < 0, oBtn:nLeft := 0, oBtn:nLeft += nCol - nMCol ), ) }
oBtn:bLButtonUp = { || ReleaseCapture(), If( oBtn:nLeft >= oBar:nWidth - 60, MsgInfo( "Yes" ), MsgInfo( "No" ) ) }
oBar:Refresh()
ACTIVATE WINDOW oWnd CENTERED
oCursor:End()
return nil
#include "FiveWin.ch"
function Main()
local oWnd, oCursor, oBar, oBtn, nMCol
DEFINE WINDOW oWnd
DEFINE CURSOR oCursor HAND
DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007
oWnd:oTop = nil
oWnd:oBar = nil
oBar:nTop = 80
oBar:nLeft = 50
oBar:nWidth -= 100
@ 0, 0 BTNBMP oBtn OF oBar SIZE 60, 60 ACTION MsgInfo( "slide ok" )
oBtn:oDragCursor = oCursor
oBtn:bLClicked = { | nRow, nCol | nMCol := nCol, oBtn:lPressed := .T. }
oBtn:bMMoved = { | nRow, nCol | If( oBtn:lPressed,;
( If( oBtn:nLeft + nCol - nMCol > oBar:nWidth - 60,;
Eval( oBtn:bAction ),), If( oBtn:nLeft + nCol - nMCol < 0,;
( oBtn:nLeft := 0, oBtn:lPressed := .F. ), oBtn:nLeft += nCol - nMCol ) ) ,) }
oBar:Refresh()
ACTIVATE WINDOW oWnd CENTERED
oCursor:End()
return nil
#include "FiveWin.ch"
function Main()
local oWnd, oCursor, oBar, oBtn, nMCol
DEFINE WINDOW oWnd
DEFINE CURSOR oCursor HAND
DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007
oWnd:oTop = nil
oWnd:oBar = nil
oBar:nTop = 80
oBar:nLeft = 50
oBar:nWidth -= 100
@ 0, 0 BTNBMP oBtn OF oBar SIZE 60, 60 ACTION MsgInfo( "slide ok" )
oBtn:oDragCursor = oCursor
oBtn:bLClicked = { | nRow, nCol | nMCol := nCol, oBtn:lPressed := .T. }
oBtn:bMMoved = { | nRow, nCol | If( oBtn:lPressed .and. GetAsyncKey( VK_LBUTTON ),;
( If( oBtn:nLeft + nCol - nMCol > oBar:nWidth - 60,;
Eval( oBtn:bAction ),), If( oBtn:nLeft + nCol - nMCol < 0,;
( oBtn:nLeft := 0, oBtn:lPressed := .F. ), oBtn:nLeft += nCol - nMCol ) ) , oBtn:nLeft := 0 ) }
oBtn:bLButtonUp = { || oBtn:nLeft := 0, oBtn:lPressed := .F. }
oBar:Refresh()
ACTIVATE WINDOW oWnd CENTERED
oCursor:End()
return nil
Antonio Linares wrote:Enhanced version:
slide.prg
- Code: Select all Expand view
#include "FiveWin.ch"
function Main()
local oWnd, oCursor, oBar, oBtn, nMCol
DEFINE WINDOW oWnd
DEFINE CURSOR oCursor HAND
DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007
oWnd:oTop = nil
oWnd:oBar = nil
oBar:nTop = 80
oBar:nLeft = 50
oBar:nWidth -= 100
@ 0, 0 BTNBMP oBtn OF oBar SIZE 60, 60 ACTION MsgInfo( "slide ok" )
oBtn:oDragCursor = oCursor
oBtn:bLClicked = { | nRow, nCol | nMCol := nCol, oBtn:lPressed := .T. }
oBtn:bMMoved = { | nRow, nCol | If( oBtn:lPressed .and. GetAsyncKey( VK_LBUTTON ),;
( If( oBtn:nLeft + nCol - nMCol > oBar:nWidth - 60,;
Eval( oBtn:bAction ),), If( oBtn:nLeft + nCol - nMCol < 0,;
( oBtn:nLeft := 0, oBtn:lPressed := .F. ), oBtn:nLeft += nCol - nMCol ) ) , oBtn:nLeft := 0 ) }
oBtn:bLButtonUp = { || oBtn:nLeft := 0, oBtn:lPressed := .F. }
oBar:Refresh()
ACTIVATE WINDOW oWnd CENTERED
oCursor:End()
return nil
#include "FiveWin.ch"
function Main()
local oWnd, oBar, oBtn, nMCol
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007
oWnd:oTop = nil
oWnd:oBar = nil
oBar:nTop = 80
oBar:nLeft = 50
oBar:nWidth -= 100
@ 0, 0 BTNBMP oBtn OF oBar SIZE 60, 60 ;
ACTION If( oBtn:nLeft > oBar:nWidth - 60, MsgInfo( "slide ok" ),)
oBtn:bMMoved = { | nRow, nCol | If( oBtn:lPressed .and. nMCol == nil, nMCol := nCol, ),;
If( oBtn:lPressed .and. GetAsyncKey( VK_LBUTTON ),;
If( oBtn:nLeft + nCol - nMCol < 0,,;
oBtn:nLeft += nCol - nMCol ),;
( oBtn:nLeft := 0, nMCol := nil ) ) }
ACTIVATE WINDOW oWnd CENTERED
return nil
Path : D:\V6\EZ4FO\RELEASE\
==========================
Path and name : D:\V6\EZ4FO\Release\EZ4FO6.EXE (32 bits)
Sizes : 10,717,696 bytes
Time from start : 0 hours 0 mins 18 secs
Error occurred at : 14/04/23, 22:29:50
Description : Warning BASE/1004 Message not found: TBAR:DEFCONTROL
Stack Calls
==========================
Called from : source\rtl\tobject.prg => TBAR:ERROR(0)
Called from : source\rtl\tobject.prg => TBAR:MSGNOTFOUND(0)
Called from : source\rtl\tobject.prg => TBAR:DEFCONTROL(0)
Called from : .\source\classes\BTNBMP.PRG => TBTNBMP:NEW(412)
Called from : D:\V6\EZ4FO\EZHKM.PRG => LOCKSCR(229)
Called from : D:\V6\EZ4FO\EZHKM.PRG => (b)HKMOBILE(152)
Called from : .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK(697)
Called from : .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP(983)
Called from : .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONDOWN(921)
Called from : .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1788)
Called from : .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(2006)
Called from : .\source\classes\WINDOW.PRG => _FWH(3541)
Antonio Linares wrote:Dear Dutch,
This version is simpler and respect the colors:
The code can be also modified so the slider stays at the right if it was properly slided...
slide.prg
- Code: Select all Expand view
#include "FiveWin.ch"
function Main()
local oWnd, oBar, oBtn, nMCol
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar OF oWnd SIZE 60, 60 2007
oWnd:oTop = nil
oWnd:oBar = nil
oBar:nTop = 80
oBar:nLeft = 50
oBar:nWidth -= 100
@ 0, 0 BTNBMP oBtn OF oBar SIZE 60, 60 ;
ACTION If( oBtn:nLeft > oBar:nWidth - 60, MsgInfo( "slide ok" ),)
oBtn:bMMoved = { | nRow, nCol | If( oBtn:lPressed .and. nMCol == nil, nMCol := nCol, ),;
If( oBtn:lPressed .and. GetAsyncKey( VK_LBUTTON ),;
If( oBtn:nLeft + nCol - nMCol < 0,,;
oBtn:nLeft += nCol - nMCol ),;
( oBtn:nLeft := 0, nMCol := nil ) ) }
ACTIVATE WINDOW oWnd CENTERED
return nil
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 49 guests