Page 1 of 1
BTNBMP slow performance
Posted: Wed Feb 20, 2019 1:35 pm
by Maurizio
Hello Antonio or Rao ,
I have a reastaurant programm with touch interface.
I use BTNBMP to drow the buttons.
If the user wishes to charge , for example two coffe , the user presses the same butoon twice.
If the user presses the same button to quickly , the programm will charge only one coffee.
There is a waiting period before the same button can be pressed again .
I have noted that if I use BUTTONS , this problem does not arise , but I don't want to lose the graphics and colours of BTNBMP
This is a sample , if you press quickly twice on the button 'Count' , the number increases by one
Code: Select all
#include "FiveWin.ch"
function Main()
local oDlg ,oSay , n := 0
DEFINE DIALOG oDlg SIZE 370, 400
@ 1, 1 SAY oSay VAR n COLOR CLR_HRED OF oDlg
@ 11, 138 BTNBMP OF oDlg SIZE 40, 15 PIXEL 2007 NOBORDER ;
PROMPT " &Clear " LEFT ;
ACTION n := 0 ,oSay:Refresh()
@ 100, 2 BTNBMP OF oDlg SIZE 180, 18 PIXEL 2007 NOBORDER PROMPT " COUNT" ;
LEFT ;
ACTION n++ ,oSay:Refresh()
ACTIVATE DIALOG oDlg CENTERED
return nil
Regards
Maurizio
http://www.nipeservice.com
Re: BTNBMP slow performance
Posted: Wed Feb 20, 2019 2:55 pm
by FranciscoA
+1
Yes. I also have the same problem, for a long time.
Re: BTNBMP slow performance
Posted: Thu Feb 21, 2019 1:34 am
by cnavarro
Please, try with this
In your sample
Code: Select all
local oBtn2
.../...
@ 100, 2 BTNBMP oBtn2 OF oDlg SIZE 180, 18 PIXEL 2007 NOBORDER PROMPT " COUNT" ;
LEFT ;
ACTION n++ ,oSay:Refresh()
oBtn2:bLDblClick := { || oBtn2:Click() }
In an existing dialog or window
Code: Select all
AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 9:54 am
by Maurizio
Thanks Navarro
this works
Code: Select all
@ 100, 2 BTNBMP oBtn2 OF oDlg SIZE 180, 18 PIXEL 2007 NOBORDER PROMPT " COUNT" ;
LEFT ;
ACTION n++ ,oSay:Refresh()
oBtn2:bLDblClick := { || oBtn2:Click() }
Bat I have an array of BTNBMP and I this dosn't work
Code: Select all
oBtn[n]:bLDblClick := { || oBtn[n]:Click() }
I try your code , but dosn't work
Code: Select all
AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )
Code: Select all
Compiling...
Harbour 3.2.0dev (r1703231115)
Copyright (c) 1999-2016, http://harbour-project.org/
Compiling 'sistem.prg' and generating preprocessed output to 'sistem.ppo'...
1 error
No code generated.
sistem.prg(31) Error E0005 Outer codeblock variable 'O' is out of reach
* Compile errors *
Maurizio
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 11:16 am
by cnavarro
Maurizio wrote:Thanks Navarro
this works
Code: Select all
@ 100, 2 BTNBMP oBtn2 OF oDlg SIZE 180, 18 PIXEL 2007 NOBORDER PROMPT " COUNT" ;
LEFT ;
ACTION n++ ,oSay:Refresh()
oBtn2:bLDblClick := { || oBtn2:Click() }
Bat I have an array of BTNBMP and I this dosn't work
Code: Select all
oBtn[n]:bLDblClick := { || oBtn[n]:Click() }
I try your code , but dosn't work
Code: Select all
AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )
Code: Select all
Compiling...
Harbour 3.2.0dev (r1703231115)
Copyright (c) 1999-2016, http://harbour-project.org/
Compiling 'sistem.prg' and generating preprocessed output to 'sistem.ppo'...
1 error
No code generated.
sistem.prg(31) Error E0005 Outer codeblock variable 'O' is out of reach
* Compile errors *
Maurizio
Yes, I wrote it quickly and I did not probe it, I just wanted to convey the idea
Call this function at init clause of dialog or window container, or before ACTIVATE directly
Code: Select all
Function MyClick( oDlg )
local o
local x
For x = 1 to Len( oDlg:aControls )
o := oDlg:aControls[ x ]
if o:ClassName() == "TBTNBMP"
o:bLDblClick := { || o:Click() }
endif
Next x
Return nil
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 11:21 am
by Marc Venken
Out of interest...
I have a touchscreen laying arround....
In order to try this kind of functions on a touchscreen, do I need to install extra FW software or simply install the screen ?
The touch driver can be found on the internet and need to be installed.
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 12:09 pm
by cnavarro
Marc Venken wrote:Out of interest...
I have a touchscreen laying arround....
In order to try this kind of functions on a touchscreen, do I need to install extra FW software or simply install the screen ?
The touch driver can be found on the internet and need to be installed.
Do not need anything additional with Fw
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 1:35 pm
by Euclides
Hi Cristóbal... sorry for jumping in...
Code: Select all
local o
...
ACTIVATE DIALOG oDlg CENTERED ON INIT ;
AEVal( oDlg:aControls, { |a,x| o := oDlg:aControls[ x ], if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )
Regards, Euclides
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 1:39 pm
by Maurizio
Navarro
same problem , with array of BTNBMP dosn't works
Maurizio
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 2:31 pm
by cnavarro
Maurizio, this work ok for me
Code: Select all
#include "FiveWin.ch"
function Main()
local oDlg ,oSay , n := 0
local aBtns := Array( 2 )
DEFINE DIALOG oDlg SIZE 370, 400
@ 1, 1 SAY oSay VAR n COLOR CLR_HRED OF oDlg
@ 11, 138 BTNBMP aBtns[ 1 ] OF oDlg SIZE 40, 15 PIXEL 2007 NOBORDER ;
PROMPT " &Clear " LEFT ;
ACTION n := 0, oSay:Refresh()
@ 100, 2 BTNBMP aBtns[ 2 ] OF oDlg SIZE 180, 18 PIXEL 2007 NOBORDER PROMPT " COUNT" ;
LEFT ;
ACTION n++ ,oSay:Refresh()
ACTIVATE DIALOG oDlg CENTERED ON INIT MyClick( oDlg )
return nil
//----------------------------------------------------------------------------//
Function MyClick( oDlg )
local o
local x
For x = 1 to Len( oDlg:aControls )
o := oDlg:aControls[ x ]
if o:ClassName() == "TBTNBMP"
o:bLDblClick := { || o:Click() }
endif
Next x
Return nil
//----------------------------------------------------------------------------//
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 3:00 pm
by cnavarro
With solution of Euclides
Code: Select all
//----------------------------------------------------------------------------//
Function MyClick( oDlg )
local o
AEVal( oDlg:aControls, { | oBtt | o := oBtt, if( oBtt:ClassName() == "TBTNBMP", oBtt:bLDblClick := { || o:Click() }, ) } )
Return nil
//----------------------------------------------------------------------------//
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 4:52 pm
by Maurizio
Thanks Navarro ,
I have to look why in your example it goes.
Maurizio