FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour BTNBMP slow performance
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
BTNBMP slow performance
Posted: Wed Feb 20, 2019 01: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 (fw): Select all Collapse
#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
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: BTNBMP slow performance
Posted: Wed Feb 20, 2019 02:55 PM

+1
Yes. I also have the same problem, for a long time.

Francisco J. Alegr铆a P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BTNBMP slow performance
Posted: Thu Feb 21, 2019 01:34 AM
Please, try with this

In your sample

Code (fw): Select all Collapse
   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 (fw): Select all Collapse
聽 聽 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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 09:54 AM
Thanks Navarro

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


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


Code (fw): Select all Collapse
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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 11:16 AM
Maurizio wrote:Thanks Navarro

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


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


Code (fw): Select all Collapse
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 (fw): Select all Collapse
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
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: BTNBMP slow performance
Posted: 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.08 with Harbour
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BTNBMP slow performance
Posted: 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
Posts: 159
Joined: Wed Mar 28, 2007 01:19 PM
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 01:35 PM
Hi Crist贸bal... sorry for jumping in...

Code (fw): Select all Collapse
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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 01:39 PM

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

Maurizio

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 02:31 PM
Maurizio, this work ok for me

Code (fw): Select all Collapse
#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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 03:00 PM
With solution of Euclides

Code (fw): Select all Collapse
//----------------------------------------------------------------------------//

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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: BTNBMP slow performance
Posted: Fri Feb 22, 2019 04:52 PM

Thanks Navarro ,

I have to look why in your example it goes.

Maurizio

Continue the discussion