Hello,
I'm using an UltraWinGrid. Depending on my indata I wish to add a number of unbound boolean columns. I want to group these columnheaders together using the grouping feature that was added in 9.1. My problem is that when I add these columns (and their common group) the group is hidden behind my databound columns. I'm guessing that this has something to do with RowLayoutGroupInfo and OriginX, OriginY. But after modifying the code in a number of ways, I still can't figure out how to make my new group not get hidden behind the already existing columns.
Is there any good tutorial on setting up this kind of "on the fly" scheme in a WinGrid with unbound columns?
Chers, Johan
Hi Johan,
Are you setting the OriginX and OriginY of the new group? I think if you don't set it at all, then the default values are -1 and this means it will place the grid at the right-hand side of the layout. Or maybe it's -2 that will do that.
If those don't work, then what you need to do is take a look at the groups or columns that you have currently display and look at the OriginXResolved and SpanX of each one. You only have to worry about the top-level ones. For example, if you have columns inside a group, then you can ignore those. You only need to be concerned with groups and columns that are at the root level and are not contained inside another group.
Then you just have to find the highest OriginXResolved+SpanX to find out the coordinates of the last logical column in the layout and you can set SpanX on the new group to that value so it's at the end.
Thank you for your reply,
I was experimenting with OriginX a lot to get the desired effect. I managed to get the columns right most by setting the OriginX to a high value.. but I really desire the columns to be in the middle, not the far right. The way I did these settings before was by editing DisplayLayout (ie I was not working in the InitializeLayout method). Right now I'm experimenting with using InitializeLayout instead.. One problem with InitializeLayout for me is that it is called before I have the information I need to know what columns I need to add. If I set the datasource to null and then my source again, InitializeLayout is called, but it seems that my other settings (like what columns that are hidden) are reset. On other problem I have is that SpanY should be 2 on all columns except my unbound (I want the grid too like it usually does when you configure this in the designer). Even if I try to do this coding in the InitializeLayout I still can't get my other columns to have SpanY = 2.
Once OriginXResolved is set, is it possible to change its value again? Or are there a lot of constraints on what can be done when adding unbound columns?
Regards, Johan
Ok, I have to modify that statement. Getting SpanY = 2 worked just fine as long as I set SpanY = 1 on my new columns :) .