Notifications
Clear all

[Closed] ListView UI : how to control?

I’m trying to create a vray materials listview rollout, but can’t get the table to scale with the size of the window it sits in.

Are there any good tutorials on controlling the ui of a rollout?

Any suggestions appreciated!

The script so far is…

 ---------------------------------------------------------------------------
 --MATERIAL LISTER
 --Beta 0.0.1
 --Started 21.02.06
 --Code By Patrick Macdonald
 --mail@reformstudios.com
 ---------------------------------------------------------------------------
 --SHORT DESCRIPTION:
 --Listing of all scene materials with control over all material properties.
 ---------------------------------------------------------------------------
 ---------------------------------------------------------------------------
 
 
 
 --------------------------
 --Define a default layout--
 ---------------------------
 
 macroScript SceneListView category:"HowTo"
 
 (
 global listview_rollout
 rollout listview_rollout "Scene Vray Materials"
 
 (
 
 
 -- Initialise spreadsheet 
 -- Courtesy of Bobo's Spreadsheet Editor
 
 fn initListView lv =
 
 (
 	enableAccelerators = false
 	lv.ListItems.clear()
 	lv.Arrange = #lvwAutoLeft
 	lv.View = #lvwReport
 	lv.Appearance = #cc3D 			--: AppearanceConstants( #ccFlat | #cc3D )
 	lv.fullRowSelect = true 
 	lv.BorderStyle = 	#ccNone 	--: BorderStyleConstants( #ccNone | #ccFixedSingle )
 	lv.FlatScrollBar = false 
 	lv.HoverSelection = false
 	lv.TextBackground = #lvwOpaque 	--: ListTextBackgroundConstants( #lvwTransparent | #lvwOpaque )
 	lv.gridLines = true
 	lv.view = #lvwReport
 	lv.fullRowSelect = true
 	lv.multiSelect = true
 	lv.labelEdit = #lvwManual
 	lv.hideSelection = false
 	lv.sorted = false
 	lv.sortorder = #lvwAscending
 	lv.hideColumnHeaders = false
 	lv.allowColumnReorder = true
 	lv.HotTracking = false
 	lv.checkboxes = false
 	textColor = ((colorman.getColor #text)*255) as color
 	windowColor = ((colorman.getColor #window)*255) as color
 	lv.backColor = (color windowColor.b windowColor.g windowColor.r)
 	lv.foreColor = (color textColor.b textColor.g textColor.r)
 	
 	cnt = lv.ColumnHeaders.count
 	for i = 1 to cnt do
 	(
 		lv.ColumnHeaders.remove 1
 	)
 
 	layout_def = #(#("Material Name",120), #("Material Class",120), #("Refl. Glossiness",50), #("Subdivs",50))
 
 	for i in layout_def do
 	(
 		column = lv.ColumnHeaders.add() 
 		column.text = i[1]
 	) 
 	
 	LV_FIRST = 0x1000
 	LV_SETCOLUMNWIDTH = (LV_FIRST + 30)
 	for i = 0 to layout_def.count-1 do 
 		windows.sendMessage lv.hwnd LV_SETCOLUMNWIDTH i layout_def[1+i][2]
 )
 
 
 
 
 
 --------------------------
 -- Enter values into table
 --------------------------
 fn fillInSpreadSheet lv =
 (
 	cnt=1
 	for o in sceneMaterials do
 	(
 	
 		if isProperty sceneMaterials[cnt] "category" do -- is category defined?
 		(
 			if sceneMaterials[cnt].category == #VRay do
 			(
 				li = lv.ListItems.add()
 				li.text = o.name
 				sub_li = li.ListSubItems.add()
 				sub_li.text = (classof o) as string
 				sub_li = li.ListSubItems.add()
 				sub_li.text = try((o.reflection_glossiness) as string)catch("--")
 				sub_li.tooltipText = "reflection_glossiness"
 				sub_li = li.ListSubItems.add()
 				sub_li.text = try((o.reflection_subdivs) as string)catch("--")
 				sub_li = li.ListSubItems.add()
 				
 			)	
 		)
 	cnt+=1
 	)
 ) 
 
  
 ----------
 -- MAIN --
 ----------
 
 activeXControl lv_objects "MSComctlLib.ListViewCtrl" width:490 height:490 align:#center 
 
 on listview_rollout open do 
 
 (
 	initListView lv_objects
 	fillInSpreadSheet lv_objects
 ) 
 
 
 )
 
 try(destroyDialog listview_rollout)catch()
 
 createDialog listview_rollout width:500 height:500 style:#(#style_titlebar, #style_sysmenu, #style_resizing, #style_minimizebox, #style_maximizebox )
 
 )
 
  
6 Replies

Hi Patrick,

If you meant when resizing:
on listview_rollout resized val do lv_objects.size = val – [10,10]

Light

1 Reply
(@deko-lt)
Joined: 11 months ago

Posts: 0

Not work,
this probably must be by sending some Message to ActiveX control… 🙁

here’s a snippet from the code of one of my tools, it’s basically the same as light suggested – it works


			#(sourceSubs_tv,targetSubs_tv).size.x = (dialogSize.x - 80)/2
			#(sourceSubs_tv,targetSubs_tv).size.y = (dialogSize.y - 205)

on listview_rollout resized val do lv_objects.size = val - [10,10]

does work indeed

Hi,

with active-x controls you have to specify size with point2’s .

do this:


 on listview_rollout resized size do( lv_objects.size = [size.x-10,size.y-10] )
 

also say you want to resize the first column to expand/contract as well:


  on listview_rollout resized size do( 
       lv_objects.size = [size.x-10,size.y-10] 
       windows.sendMessage lv_objects.hwnd (0x1000+30) 0 (size.x - 380)
  )
 

Bill

(sorry this is a duplicate post, had problems submitting the first one)