Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamically dropping / adding form objects every 60 seco
Message
From
03/08/2007 06:45:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
02/08/2007 15:08:18
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01245612
Message ID:
01245736
Views:
17
This message has been marked as a message which has helped to the initial question of the thread.
>I have a Foxpro 2.6 application that I am converting to VFP 9. The main form of the application is designed for a touch screen. The screen is filled with buttons and each button represents a job or a person that is located in a work center. The old program completely redraws the buttons, which are labels, every 60 seconds. I need the same functionality in the new application and want to use command buttons.
>
>My problem is that the job buttons are one size and the employee buttons are much smaller. The form has five rows of buttons. Each row holds 10 employee buttons or five job buttons. All the employees in the work center are displayed and then any open space that is left is used for the job buttons. The job buttons will go on the same row as the employee buttons if there is empty space on the row. If there are more jobs in the work center than can be displayed on the screen then page up and page down buttons are activated. Jobs are moved around constantly and there are a couple thousand jobs in circulation all the time so the jobs that are in the work center change constantly.
>
>Because the contents of all five rows will change every time the screen refreshes I am trying to figure out the best way to regenerate the screen. I cannot find a way to add and remove the button objects once the form is loaded which is what I would like to do.
>
>Is there a way to remove / add commandbuttons to a form in the refresh?
>
>Otherwise, my thoughts are that I can do one of these options;
>
>1) put 10 buttons on each row, if the button is for a job increase the size and hide the button next to it so only 5 buttons are visible. Seems messy.
>
>2) close and reopen the form every time it is refreshed so that each button is created at the correct size
>
>Is there an easier way to do this?

Margaret,
Maybe it's just me but I wouldn't do it in refresh method. Instead I'd create a custom ReDraw method and handle changes there. In pseudocode:

thisform.lockscreen = .t.
* arrange for new look
thisform.lockscreen = .f.

I'd hide the ones I don't need and just arrange visible ones' top,left,height,width (height and width in buttontype_assign) rather than adding/removing objects which may lead to memory leaks over time. If you'd do that by removing then be sure you set their visible property to .f. first. I have seen weird affects if you don't do so.
Since you have at most 50 buttons at a time, initially creating 50 buttons and just playing with their properties would be best IMHO.

PS: Though not needed as a side note you can host a web browser in VFP form, and thus use an HTM as your touch screen.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform