BTNBMP slow performance

BTNBMP slow performance

Postby Maurizio » Wed Feb 20, 2019 1:35 pm

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 view

#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
Maurizio
 
Posts: 796
Joined: Mon Oct 10, 2005 1:29 pm

Re: BTNBMP slow performance

Postby FranciscoA » Wed Feb 20, 2019 2:55 pm

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

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2110
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: BTNBMP slow performance

Postby cnavarro » Thu Feb 21, 2019 1:34 am

Please, try with this

In your sample

Code: Select all  Expand view


   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 view

    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
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BTNBMP slow performance

Postby Maurizio » Fri Feb 22, 2019 9:54 am

Thanks Navarro

this works
Code: Select all  Expand view
@ 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 view
oBtn[n]:bLDblClick := { || oBtn[n]:Click() }


I try your code , but dosn't work
Code: Select all  Expand view
 AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )


Code: Select all  Expand view
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
Maurizio
 
Posts: 796
Joined: Mon Oct 10, 2005 1:29 pm

Re: BTNBMP slow performance

Postby cnavarro » Fri Feb 22, 2019 11:16 am

Maurizio wrote:Thanks Navarro

this works
Code: Select all  Expand view
@ 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 view
oBtn[n]:bLDblClick := { || oBtn[n]:Click() }


I try your code , but dosn't work
Code: Select all  Expand view
 AEVal( oDlg:aControls, { | o | if( o:ClassName() == "TBTNBMP", o:bLDblClick := { || o:Click() }, ) } )


Code: Select all  Expand view
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 view

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: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BTNBMP slow performance

Postby Marc Venken » Fri Feb 22, 2019 11:21 am

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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: BTNBMP slow performance

Postby cnavarro » Fri Feb 22, 2019 12:09 pm

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
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BTNBMP slow performance

Postby Euclides » Fri Feb 22, 2019 1:35 pm

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

Code: Select all  Expand view

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
Euclides
 
Posts: 154
Joined: Wed Mar 28, 2007 1:19 pm

Re: BTNBMP slow performance

Postby Maurizio » Fri Feb 22, 2019 1:39 pm

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

Maurizio
User avatar
Maurizio
 
Posts: 796
Joined: Mon Oct 10, 2005 1:29 pm

Re: BTNBMP slow performance

Postby cnavarro » Fri Feb 22, 2019 2:31 pm

Maurizio, this work ok for me

Code: Select all  Expand view


#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: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BTNBMP slow performance

Postby cnavarro » Fri Feb 22, 2019 3:00 pm

With solution of Euclides

Code: Select all  Expand view


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

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
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: BTNBMP slow performance

Postby Maurizio » Fri Feb 22, 2019 4:52 pm

Thanks Navarro ,

I have to look why in your example it goes.

Maurizio
User avatar
Maurizio
 
Posts: 796
Joined: Mon Oct 10, 2005 1:29 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 8 guests