BTNBMP slow performance

Post Reply
User avatar
Maurizio
Posts: 827
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

BTNBMP slow performance

Post 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 | Expand


#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
User avatar
FranciscoA
Posts: 2164
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: BTNBMP slow performance

Post by FranciscoA »

+1
Yes. I also have the same problem, for a long time.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: BTNBMP slow performance

Post by cnavarro »

Please, try with this

In your sample

Code: Select all | Expand



   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 | Expand


    AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
Maurizio
Posts: 827
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: BTNBMP slow performance

Post by Maurizio »

Thanks Navarro

this works

Code: Select all | Expand

@ 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 | Expand

oBtn[n]:bLDblClick := { || oBtn[n]:Click() }


I try your code , but dosn't work

Code: Select all | Expand

 AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )


Code: Select all | Expand

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
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: BTNBMP slow performance

Post by cnavarro »

Maurizio wrote:Thanks Navarro

this works

Code: Select all | Expand

@ 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 | Expand

oBtn[n]:bLDblClick := { || oBtn[n]:Click() }


I try your code , but dosn't work

Code: Select all | Expand

 AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )


Code: Select all | Expand

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 | Expand


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
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
Marc Venken
Posts: 1485
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: BTNBMP slow performance

Post 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.
Marc Venken
Using: FWH 23.08 with Harbour
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: BTNBMP slow performance

Post 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
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
Euclides
Posts: 157
Joined: Wed Mar 28, 2007 1:19 pm

Re: BTNBMP slow performance

Post by Euclides »

Hi Cristóbal... sorry for jumping in...

Code: Select all | Expand


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
User avatar
Maurizio
Posts: 827
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: BTNBMP slow performance

Post by Maurizio »

Navarro
same problem , with array of BTNBMP dosn't works

Maurizio
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: BTNBMP slow performance

Post by cnavarro »

Maurizio, this work ok for me

Code: Select all | Expand



#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

//----------------------------------------------------------------------------//
 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
Posts: 6558
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: BTNBMP slow performance

Post by cnavarro »

With solution of Euclides

Code: Select all | Expand



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

Function MyClick( oDlg )

   local o
   AEVal( oDlg:aControls, { | oBtt | o := oBtt, if( oBtt:ClassName() == "TBTNBMP", oBtt:bLDblClick := { || o:Click() }, ) } )

Return nil

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

 
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
Maurizio
Posts: 827
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: BTNBMP slow performance

Post by Maurizio »

Thanks Navarro ,

I have to look why in your example it goes.

Maurizio
Post Reply