Large numbers of DCPUSHButtons

This forum is for eXpress++ general support.
Post Reply
Message
Author
gradosic
Posts: 45
Joined: Tue Dec 07, 2010 2:11 pm
Location: Croatia - Europe
Contact:

Large numbers of DCPUSHButtons

#1 Post by gradosic »

Hi everyone,

We have one issue with creating large numbers of pushbuttons because they are working very slow.

To explain whole thing: It’s in POS application for restaurant where we have main screen with articles on screen, browse, etc., and one of features is “table preview” where waiters can see schematic preview of tables. Of course they call this “tables preview” when they need it, and if there is 20-30 tables (pushbuttons) on this preview it takes 1-2 seconds for application to create this window and show tables. Usually when you say 1-2 seconds, it’s doesen't seems to long, but believe me when is rush time it’s disaster! Is there any way that I can create this screen with tables (lots of pushbuttons) and keep it in memory, and just to call that screen when I need it (so I don’t need to create every time). Another thread or something?

To explain better I attach preview of main screen (main.PNG) and screen of tables (tables preview)... also I put part of code that draw this pushbuttons (table) on screen.
Attachments
TABLES.PNG
TABLES.PNG (59.84 KiB) Viewed 14301 times
main.png
main.png (154.31 KiB) Viewed 14301 times
Goran Radosic

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Large numbers of DCPUSHButtons

#2 Post by c-tec »

Hello,
have the same problem, I think gradient and such things are slowing down. They are also flashing very slow on a refresh oder some events
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

gradosic
Posts: 45
Joined: Tue Dec 07, 2010 2:11 pm
Location: Croatia - Europe
Contact:

Re: Large numbers of DCPUSHButtons

#3 Post by gradosic »

Hi,

Gradient? You mean pictures and similar? That's no issue, becaouse i try (for test) instead pushbuttons to put small static objects with text, and also is slow... It simply need time to draw window, and only way to avoid that is to keep window "somewhere down" and show it when needed... but I don't know how..
Goran Radosic

skiman
Posts: 1194
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: Large numbers of DCPUSHButtons

#4 Post by skiman »

Hi,

Put the buttons on a static and hide the static. As soon as you need it, show the static.
Best regards,

Chris.
www.aboservice.be

gradosic
Posts: 45
Joined: Tue Dec 07, 2010 2:11 pm
Location: Croatia - Europe
Contact:

Re: Large numbers of DCPUSHButtons

#5 Post by gradosic »

Hi Chris,

thanks for reply but if I do that like this, I'm not able to keep focus on that static... in that case user can also click main screen... ? any other sugestion?
Goran Radosic

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Large numbers of DCPUSHButtons

#6 Post by rdonnay »

Show me the code that you use to create the buttons.
The eXpress train is coming - and it has more cars.

gradosic
Posts: 45
Joined: Tue Dec 07, 2010 2:11 pm
Location: Croatia - Europe
Contact:

Re: Large numbers of DCPUSHButtons

#7 Post by gradosic »

Roger,

code in attach
Attachments
radni.zip
(2.54 KiB) Downloaded 728 times
Goran Radosic

User avatar
rdonnay
Site Admin
Posts: 4745
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Large numbers of DCPUSHButtons

#8 Post by rdonnay »

I looked at your code and I think that much of the slowness is due to the fact that you are using DCPUSHBUTTON STATIC buttons. If I could get rid of this code in eXpress++ I would do so but there is such a thing as a "legacy".

I developed the DCPUSHBUTTONXP style buttons soon after Xbase++ started supporting Ownerdrawing for the XbpPushButton() class. This is a much better way to create complex and visually appealling buttons because there is only one object created for each button.

Run the \exp19\samples\buttonxp\buttonxp.prg sample program.
You will see that it will create many buttons on the screen very quickly.
Also, I recommend creating only 1 bitmap for all your buttons instead of separate bitmaps.

Example:

oBitmap := DC_GetBitMap('Table.Jpg')

@ 1,1 DCPUSHBUTTONXP CAPTION '1' BITMAP oBitmap
@ 2,1 DCPUSHBUTTONXP CAPTION '2' BITMAP oBitmap

This is a simplified explanation. In your case you will probably want to use a CAPTIONARRAY clause.
Look at this in the sample program.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1421
Joined: Wed Feb 24, 2010 3:44 pm

Re: Large numbers of DCPUSHButtons

#9 Post by Auge_Ohr »

gradosic wrote:We have one issue with creating large numbers of pushbuttons because they are working very slow.
as i "see" you use Tabpage too and i guess there are more Pushbuttons ...
as Chris say : hide all when create and show when need but you just need to show what you can see

Question : are you create Pushbutton for other Tabpage in same Thread ?

once i did had create a virtual Keyboard and start with 102 Pushbutton ... but that was "slow"
next Version was just 1 Static but "inside" i paint a X / Y Grid which act as "Button" ( LbDown)

p.s. Xbase++ use GDI32 which is 2D. if you compare Grafic-Card 2D Benchmark you will "see"
that "power" GFK like NVidea 680 are "less" than Intel "build-in" HD4000 GFK Solution.
greetings by OHR
Jimmy

gradosic
Posts: 45
Joined: Tue Dec 07, 2010 2:11 pm
Location: Croatia - Europe
Contact:

Re: Large numbers of DCPUSHButtons

#10 Post by gradosic »

Auge i't possible to create static object, but when I put buttons in static and HIDE static, buttons stay visible even they are parent to static... Why hide function don't work with parent obect inside static?
Goran Radosic

Post Reply