.NET Forum / Visual Studio.NET / General / May 2008
Dynamic controls and accessing them by TabOrder
|
|
Thread rating:  |
doug - 24 Apr 2008 01:45 GMT I have built an app that creates 1-n tabs on Tab Control, and each tab has a panel, and each panel has 1-n columns of checkboces and 1-n rows. I build the controls left to right (by column) and then row by row (top down). I assign a TabIndex to each such that column 1 boxes are 101, 102, 103, and column n boxes are n01, n02, n03.
When I run the form and select 2 items in 2 columns it processes them in left to right and then top down, and not top down left to right as I need it to be done. I added the GetNextControl method which says it uses taborder.
I can supply code or maybe psuedocode as it gets wordy referencing the items dynamically.
Jeffrey Tan[MSFT] - 24 Apr 2008 06:38 GMT Hi Doug,
Creating so many controls is not a good solution in Win32/Winform GUI programming. This is because a control is considered as a window in Windows. Each window is associated with some resource such as Window structure etc... Many of the resource are allocated from the Windows desktop heap in kernel-mode.
There may be two problems regarding this: 1. If we create too many controls, the desktop heap may be exhausted. No controls/windows can be created anymore. 2. The maximum number of controls/windows a process can create is a limited value.
That's why IE and WPF both do not use the Win32 controls/windows, they draw the controls themselves.
Have you considered of using DataGridView control to implement the table style GUI application?
Anyway, if you really get this resolved, please feel free to provide a sample project, I will give it a reproduce and examination.
Thanks.
Best regards, Jeffrey Tan Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
doug - 24 Apr 2008 16:11 GMT I will look into the DataGrid option. I noticed the windows handles using spy++ and wondered. When I say 1-n, it ends up (currently) around 1000 controls between labels, checkboxes, and pictureboxes, and supporting controls like panels. The reason we changed to dynamic controls was so we wouldn't have to manually manage the tabs and checkboxes when users change the mix of reports which can be several times a months, to once every several months. It took me about 6 hours to manually add new tabs and options. And it didn't keep up with when they needed it. Dynamic controls fixed this. If datagrid works the same, it also seems I have more control reading down first than left to right first. I assume I can navigate the cells as I want, then look for specific checkboxes in each cell?
I cannot upload my project to this forum. And I won't have time in next few days to create a sample from this that demonstatres my problem.
> Hi Doug, > [quoted text clipped - 49 lines] > ================================================== > This posting is provided "AS IS" with no warranties, and confers no rights. Jeffrey Tan[MSFT] - 25 Apr 2008 03:30 GMT Hi Doug,
Thanks for your feedback.
Yes, DataGridView should meet your need. DataGridView did not create a separate control for each cell, but paints the cell which looks like a control. Also, DataGridView cells in rows/columns can both expand automatically without too much work. It is designed for the report/table style of GUI.
I know about the time stress issue. Ok, if you have time to check it again, please feel free to post or feedback, thanks.
Best regards, Jeffrey Tan Microsoft Online Community Support ========================================= Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
doug - 25 Apr 2008 22:25 GMT I have a smaller sampling of my project set up using DataGridView and have what was labels and cyeck boxes working very nicely, in fact, I'm getting the output order the way I want, and it is much simplier, cleaner code.
I had assumed you could put conrols into a cell more or less the same as you might a panel. In my panel implementation there is a picturebox next to each checkbox. It starts out hidden. After you select checkboxes you want and then selection the action you want, I loop thru processing each checked box, and based on if the action worked or not, I move in a bmp image indicating success (green image) or failure (red image) then make it visible.
I have set the column to a picturebox type, but I have not gotten the image to display, even in testing it to force picture during form load. I have read a few places that images don't show (or maybe move) unless row selected. In this app, you don't actally select rows or edit anything. Just pick which checkboxes you want.
> Hi Doug, > [quoted text clipped - 20 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights. Jeffrey Tan[MSFT] - 28 Apr 2008 03:22 GMT Hi Doug,
Thanks for your feedback.
Do you get the image showing problem in DataGridView, or in your own panel? As I know, there is no "picturebox type" column in DataGridView, but the DataGridViewImageColumn. Do you use DataGridViewImageColumn and get this problem?
> I had assumed you could put conrols into a cell more or less the same as you > might a panel Not true yet. We can not add any control into DataGridView cell at will. The DataGridView has its own component model, so it has some limitations. First, all the controls in one column(DataGridViewColumn) must be of the same type. That is we can not place TextBox and CheckBox in the same column in DataGridView. This model implies that we can not add any control to a Cell at will. Second, there are only 6 DataGridViewColumn types in build-in yet, so not all controls can be hosted in DataGridView. If you need to host other controls in DataGridView, we have to write one customized colum type ourselves. You may download the DataGridView samples from the link below(it contains most details of DataGridView component model): http://windowsclient.net/downloads/folders/applications/entry1304.aspx
Finally, for your problem, I did not see it before, if you have a small sample project that can demonstrate the problem, please feel free to send it to me at: jetan@online.microsoft.com(remove "online.").
Thanks.
Best regards, Jeffrey Tan Microsoft Online Community Support ========================================= Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
doug - 28 Apr 2008 15:36 GMT I am using DataGridView now, or trying to. I know very little about DataGridView except that it will display pictures. I hadn't tried the DataGridViewImageColumn but will once I get a chance. My registry is acting up a bit preventing me from openning any encrypted files this morning (think security "feature"). So I'm waiting for an internal level 2 support return call. The source control version is not current to therse recent changes.
> Hi Doug, > [quoted text clipped - 37 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights. Jeffrey Tan[MSFT] - 29 Apr 2008 03:57 GMT Hi Doug,
Thanks for your confirmation.
If I understand you correctly, your registry has some problem so you can not access the lastest project files yet.
Ok, if you are able to check this issue again and need further help, please feel free to feedback, thanks.
Best regards, Jeffrey Tan Microsoft Online Community Support ========================================= Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
doug - 06 May 2008 14:24 GMT I spent some time researching the DataGridViewImageColumn & DataGridViewImageCell and I don't mind fessing up to it being non-intuitive. I just want a "result" image to display next to checkboxes. Initial state of cell is blank, then if checkbox is selected and the action performed, show a green checkmark for good or a red X for bad. There are a lot of examples that all seem partial or are based on bound datasets.
I'm loading the data grid from a dynamically built table, but the image columns I want to just change on the fly.
> Hi Doug, > [quoted text clipped - 17 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights. Jeffrey Tan[MSFT] - 07 May 2008 09:43 GMT Hi Doug,
Thanks for your feedback.
Oh, DataGridViewColumn does not support display two controls in the same cell/column, we have to use both a DataGridViewCheckBoxColumn and DataGridViewImageColumn togerther for this issue.
Regarding clicking the checkbox and switching different images in the DataGridViewImageCell, we can first get the CheckBox in the DataGridViewCheckBoxColumn and handle its CheckedChanged event and set different image for the DataGridViewImageCell. Does this meet your need? If not, can you help to explain why this does not meet your need? More specific, what problem do you have of using DataGridView to get what you want?
Thanks.
Best regards, Jeffrey Tan Microsoft Online Community Support ========================================= Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
doug - 09 May 2008 15:36 GMT I have the DataGridView supporting everything my original version using Panels supported, lables (in string columns), Checkboxes (in boolean columns). And I can navigate the columns and rows in the output order I need to process the checkboxes. The one piece I don't have is what I used a picturebox for before on a panel to reflect the status (good/or bad checkmarks) for the checkbox. I added DataGridViewImageColumn as a column next to the boolean column (I suppose I could changer this to a DataGridViewCheckBox column). I don't need any events tied to the checkbox. As I loop thru the checkboxes, those that are checked have actions associated with them. I want to show an image to reflect good/green or bad/red image in a column cell next to checkbox column.
Basically, users checksca lot of boxes, presses a button to cause an action, and as the actions are processed, set the adjacent cell to show the appropriate green or red BMP image 9image type can be changed to other image type if it is needed).
doug
> Hi Doug, > [quoted text clipped - 25 lines] > > This posting is provided "AS IS" with no warranties, and confers no rights.
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|