Message 1 of 4
dotNet Listview control groups not working in maxscript rollout

Not applicable
05-28-2008
05:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi guys,
I'm trying to get a dotNet Listview control to display it's items in groups like if you're in windows explorer (in vista) and choose View >> Group By >> Name for example.
I can get this to work no probs in C#, but when I try and port the code line for line over to maxscript nothing happens.
Here's the designer created C# code:
And here's my maxscript code:
I don't get any errors, the listview and item are displayed correctly but the group just doesn't display.
Thanks for any help!
G
I'm trying to get a dotNet Listview control to display it's items in groups like if you're in windows explorer (in vista) and choose View >> Group By >> Name for example.
I can get this to work no probs in C#, but when I try and port the code line for line over to maxscript nothing happens.
Here's the designer created C# code:
private void InitializeComponent()
{
System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Group 01", System.Windows.Forms.HorizontalAlignment.Left);
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("item 01");
this.myListview = new System.Windows.Forms.ListView();
this.SuspendLayout();
//
// myListview
//
listViewGroup1.Header = "Group 01";
listViewGroup1.Name = "Group 01";
this.myListview.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
listViewGroup1});
listViewItem1.Group = listViewGroup1;
this.myListview.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem1});
this.myListview.Location = new System.Drawing.Point(1, 1);
this.myListview.Name = "myListview";
this.myListview.Size = new System.Drawing.Size(289, 179);
this.myListview.TabIndex = 0;
this.myListview.UseCompatibleStateImageBehavior = false;
this.myListview.View = System.Windows.Forms.View.SmallIcon;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(289, 179);
this.Controls.Add(this.myListview);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
private System.Windows.Forms.ListView myListview;
And here's my maxscript code:
-- Killing the dialog box if it exists
try(destroyDialog KRMU_myRollout); catch()
rollout KRMU_myRollout "my Rollout" width:271 height:199
(
-- ************* LOCALS **************
-- ***********************************
-- *************** UI ****************
-- ***********************************
-- Listview dotNet control
dotNetControl myListview "System.Windows.Forms.ListView" pos: width:268 height:198 enabled:true
-- *********** FUNCTIONS *************
-- ***********************************
-- ********** UI HANDLERS ************
-- ***********************************
on KRMU_myRollout open do
(
-- Listview Group
local listViewGroup1 = dotNetObject "System.Windows.Forms.ListViewGroup" "Group 01" (dotNetClass "System.Windows.Forms.HorizontalAlignment").Left
-- Listview item
local listViewItem1 = dotNetObject "System.Windows.Forms.ListViewItem" "item 01"
-- Listview setup
listViewGroup1.header = "Group 01"
listViewGroup1.name = "Group 01"
myListview.Groups.addRange #(listViewGroup1) -- Could just use groups.add but this is how c# does it
listViewItem1.Group = listViewGroup1
myListview.Items.addRange #(listViewItem1) -- Could just use items.add but this is how c# does it
myListview.Name = "myListview"
myListview.UseCompatibleStateImageBehavior = false
myListview.View = (dotNetClass "System.Windows.Forms.View").SmallIcon
)
)
-- ************** MAIN ***************
-- ***********************************
-- create the rollout window and add the rollout
CreateDialog KRMU_myRollout
I don't get any errors, the listview and item are displayed correctly but the group just doesn't display.
Thanks for any help!
G