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.
Large numbers of DCPUSHButtons
Large numbers of DCPUSHButtons
- Attachments
-
- TABLES.PNG (59.84 KiB) Viewed 15208 times
-
- main.png (154.31 KiB) Viewed 15208 times
Goran Radosic
Re: Large numbers of DCPUSHButtons
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
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
Re: Large numbers of DCPUSHButtons
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..
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
Re: Large numbers of DCPUSHButtons
Hi,
Put the buttons on a static and hide the static. As soon as you need it, show the static.
Put the buttons on a static and hide the static. As soon as you need it, show the static.
Re: Large numbers of DCPUSHButtons
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?
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
Re: Large numbers of DCPUSHButtons
Show me the code that you use to create the buttons.
The eXpress train is coming - and it has more cars.
Re: Large numbers of DCPUSHButtons
Roger,
code in attach
code in attach
- Attachments
-
- radni.zip
- (2.54 KiB) Downloaded 786 times
Goran Radosic
Re: Large numbers of DCPUSHButtons
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.
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.
Re: Large numbers of DCPUSHButtons
as i "see" you use Tabpage too and i guess there are more Pushbuttons ...gradosic wrote:We have one issue with creating large numbers of pushbuttons because they are working very slow.
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
Jimmy
Re: Large numbers of DCPUSHButtons
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