Text Lister (Editor)

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 10 October 2012   #1
Text Lister (Editor)

Hey guys, a new tool here still in progress though. I figured I would post what I've got so far. Special thanks goes out to Rotem for helping solve some issues early on.

Here is what I'm going for. Similar to light lister but for text objects. I've been able to get



Nearly everything so far is working except for the following: (open to solutions and ideas)
1. When users change the 'Name' editText field it doesn't properly update, it craps out.
2. 'Text' field when changing text doesn't format properly back onto the objects
3. Not sure how to populate and create dropdowlist of all the possibly fonts for use
4. Updating of any changes in lister doesn't occur until the user clicks back onto the object
5. The aligment options are a bit corky because the max text shapes used checkbuttons as if they were radio buttons. The do not test for boolean but rather integer.

Anywho, I'm posting this on here in search of community help and improvements, I'm looking forward to hearing from you guys and seeing what we can build of this tool.


try (destroydialog ::rlObjEditor)catch()
rollout rlObjEditor "Object Lister" width:500 height:500
(
	fn fnPopulateList =
	(
		local rci = rolloutCreator "rlList" "Text Objects" width:500 height:500
		rci.begin()
			posY = 40
			rci.addControl #label "NameCol" "Name" paramStr:"pos:[30,12]"
			rci.addControl #label "ColorCol" "Color" paramStr:"pos:[126,12]"
			rci.addControl #label "PropertiesCol" "Properties" paramStr:"pos:[160,12]"
			rci.addControl #label "TextCol" "Text" paramStr:"pos:[290,12]"
			
			txtObjs = for o in objects where classof o == text collect o
			for i = 1 to txtObjs.count do (
				_theNode = txtObjs[i]
				alignType = _theNode.alignment
				rangeVal =
				
				rci.addControl #editText ("nameField"+ i as string) "" paramStr:("width:100 text:\"" + _theNode.name + "\" pos:" + [24,posY] as string)
				rci.addHandler ("nameField"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).name = arg")
				
				rci.addControl #button ("selector"+ i as string) ("$") paramStr:("width:20 height:20 pos:" + [5,posY-1] as string)				
				rci.addHandler ("selector"+ i as string) #pressed filter:on codeStr:(" select (getNodeByName nameField"+ i as string +".text)" )
				
				rci.addControl #colorpicker ("colorPicker"+ i as string) "" paramStr:("width:25 height:20 pos:" + [125,posY-1] as string + "color: " + _theNode.wirecolor as string)
				rci.addHandler ("colorPicker"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).wireColor = arg")
				
				rci.addControl #checkbutton ("italic"+ i as string) ("I") paramStr:("width:20 height:20 pos:" + [155,posY+22] as string + "checked: " + _theNode.italic as string)
				rci.addHandler ("italic"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).italic = arg")
				
				rci.addControl #checkbutton ("underline"+ i as string) ("U") paramStr:("width:20 height:20 pos:" + [178,posY+22] as string + "checked: " + _theNode.underline as string)
				rci.addHandler ("underline"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).underline = arg")
				
 				rci.addControl #checkbutton ("aLeft"+ i as string) ("L") paramStr:("width:20 height:20 pos:" + [205,posY+22] as string + "checked: " + (1 == alignType) as string)
				rci.addControl #checkbutton ("aCenter"+ i as string) ("C") paramStr:("width:20 height:20 pos:" + [225,posY+22] as string + "checked: " + (2 == alignType) as string)
				rci.addControl #checkbutton ("aRight"+ i as string) ("R") paramStr:("width:20 height:20 pos:" + [245,posY+22] as string + "checked: " + (3 == alignType) as string)
				rci.addControl #checkbutton ("aStraight"+ i as string) ("S") paramStr:("width:20 height:20 pos:" + [265,posY+22] as string + "checked: " + (4 == alignType) as string)
				
				rci.addControl #label ("size" + i as string) "Size:" paramStr:("pos:" + [155,posY+46] as string)
				rci.addControl #spinner ("sizeValue" + i as string) "" paramStr:("fieldwidth:55 pos:" + [218,posY+46] as string + "range:" + [0,9999999,_theNode.size] as string)
				rci.addHandler ("sizeValue"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).size = arg")
				
				rci.addControl #label ("kerning" + i as string) "Kerning:" paramStr:("pos:" + [155,posY+64] as string)
				rci.addControl #spinner ("kerningValue" + i as string) "" paramStr:("fieldwidth:55 pos:" + [218,posY+64] as string + "range:" + [-9999999,9999999,_theNode.kerning] as string)
				rci.addHandler ("kerningValue"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).kerning = arg")
				
				rci.addControl #label ("leading" + i as string) "Leading:" paramStr:("pos:" + [155,posY+82] as string)
				rci.addControl #spinner ("leadingValue" + i as string) "" paramStr:("fieldwidth:55 pos:" + [218,posY+82] as string + "range:" + [-9999999,9999999,_theNode.leading] as string)
				rci.addHandler ("leadingValue"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).leading = arg")
				
				rci.addControl #editText ("textField"+ i as string) "" paramStr:("width:195 height:99 text:\"" + _theNode.text + "\" pos:" + [285,posY] as string)
				rci.addHandler ("textField"+ i as string) #changed paramStr:"arg" codeStr:("(getNodeByName nameField"+ i as string +".text).text = arg")
				
				posY += 110
			)
		rci.end()
			
		return rci.def
	)

	subRollout srObjEditor "" pos:[0,0] width:500 height:500
	
	on rlObjEditor open do (addSubRollout srObjEditor (fnPopulateList()) rolledUp:false)
	
	on rlObjEditor resized val do (srObjEditor.height = val[2])		
)
createDialog rlObjEditor 500 500 style:#(#style_SysMenu, #style_ToolWindow, #style_resizing)
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 10 October 2012   #2
Originally Posted by JokerMartini: Nearly everything so far is working except for the following: (open to solutions and ideas)
1. When users change the 'Name' editText field it doesn't properly update, it craps out.
2. 'Text' field when changing text doesn't format properly back onto the objects
3. Not sure how to populate and create dropdowlist of all the possibly fonts for use
4. Updating of any changes in lister doesn't occur until the user clicks back onto the object
5. The aligment options are a bit corky because the max text shapes used checkbuttons as if they were radio buttons. The do not test for boolean but rather integer.


1. The handler is fired only after the text property has already changed. For example, if you had an object named Text01 and you changed the text in the textbox to Text01a, the original node would not be found because getNodeByName would already be searching for Text01a
2. Can you explain? It works fine for me.
3. The InstalledFontCollection class: http://msdn.microsoft.com/en-us/lib...collection.aspx
4. Can you explain? It works fine for me.
5. You need code for all the buttons on all the handlers. This is repetitive and messy.

Overall, I think RolloutCreator is very dated and limited. For any dynamic UI, I don't think twice about creating a dotnet UI, which is by defintion already dynamic. It would solve all of your problems in this case.
 
Old 10 October 2012   #3
Originally Posted by lo: 3. The InstalledFontCollection class: http://msdn.microsoft.com/en-us/lib...collection.aspx

max populates Text's Shape dropdownlist with fonts that installed on the system, + fonts specially installed in max's Fonts directory, and Available for max.
some years ago I've tried to collect the same list as the Text has by using only MXS and ended in failure. The only way to get the same as Text's Shape font list is to use max SDK.
 
Old 10 October 2012   #4
Maybe the dotNet method is the way to go then in that case. I've not built many UI's with dotNet so it would for sure be a new way of doing it for me.

Would I still be using a max create dialog or would i go the show.Form route?

The rolloutcreator so far has been rather cumbersome to mess with. I'm open to new methods for sure.


2. Say you create a text object and you type in the text field "Name" then hit enter twice and type another "Name". When you then adjust the text field in the TextLister it doesn't format the different lines using \n "ENTER" correctly.

5. When I would change the wirecolor of and object it wouldn't adjust the wirecolor of the object in the viewport until I selected it again. It may be one of those corky Nitrous issues. So I'm not going to worry about that right now.

Not having much experience with dotNot tools. is there a good example of the creating of rollouts dynamically I could check out to begin messing with?
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 10 October 2012   #5
Originally Posted by JokerMartini: Would I still be using a max create dialog or would i go the show.Form route?


If you decide to use a max rollout, you'd need a single dotnet control on it (such as 'panel') which you populate dynamically with DotNetObjects. If you use a dotnet form you can just add controls directly to the form.

Originally Posted by JokerMartini: 2. Say you create a text object and you type in the text field "Name" then hit enter twice and type another "Name". When you then adjust the text field in the TextLister it doesn't format the different lines using \n "ENTER" correctly.


Use
substituteString whatever.text "\n" "\r\n"


Originally Posted by JokerMartini: 5. When I would change the wirecolor of and object it wouldn't adjust the wirecolor of the object in the viewport until I selected it again. It may be one of those corky Nitrous issues. So I'm not going to worry about that right now.


Works fine for me in 2009. Probably a nitrous issue.

Originally Posted by JokerMartini: Not having much experience with dotNot tools. is there a good example of the creating of rollouts dynamically I could check out to begin messing with?


All dotnet UI creation is dynamic in maxscript. Use the same loops you are currently using, but instead of calling rolloutCreator methods, instantiate dotnetobjects and fill their properties and create event handlers for them.
 
Old 10 October 2012   #6
doesn't seem like there is an easy way to list all the fonts in a dropdownlist using dotnet for max.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 10 October 2012   #7
The method of collecting the fonts is not mine, but you can cnovert the code below to work with dotnet dropdownlist

(
	global rol_test
	try(destroyDialog rol_test)catch()
	rollout rol_test "test"
	(
		local dnFonts = dotNetObject "System.Drawing.Text.InstalledFontCollection"
		local dnFontStyle = dotNetClass "System.Drawing.FontStyle"
		
		dropDownList ddl_fontList "" pos:[5,100] width:104
		
		on rol_test open do
		(
			--	collect all fonts
			ddl_fontList.items = for font in dnFonts.Families where 
								font.IsStyleAvailable dnFontStyle.Regular and
								font.IsStyleAvailable dnFontStyle.Bold and
								font.IsStyleAvailable dnFontStyle.Italic collect font.Name
		)
	)
	createdialog rol_test 	
)
 
Old 10 October 2012   #8
miauu

Thank you very much miauu that is great.

Now does anyone have a recommended method for doing an efficient "color picker" method for dotnet. I want to display the wirecolor of each object in the panel, but also still give the functionality of changing the color to the user as well.
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 10 October 2012   #9
fonts


try(destroyDialog ::rlFonts)catch()
rollout rlFonts "test"
(
	local dnFonts = dotNetObject "System.Drawing.Text.InstalledFontCollection"
	local dnFontStyle = dotNetClass "System.Drawing.FontStyle"
	
	dotNetControl lstFonts "System.Windows.Forms.ComboBox" height:22
	
	fn collectFonts =
	(
		-- Collect fonts into an array
		_fontsArr = #()
		for font in dnFonts.Families do (
			if font.IsStyleAvailable dnFontStyle.Regular do append _fontsArr font.name
			if font.IsStyleAvailable dnFontStyle.Bold do append _fontsArr (font.name + " Bold")
			if font.IsStyleAvailable dnFontStyle.Italic do append _fontsArr (font.name + " Italic")	
			if font.IsStyleAvailable dnFontStyle.Bold AND font.IsStyleAvailable dnFontStyle.Italic do append _fontsArr (font.name + " Bold Italic")				
		)
		-- Clear the ComboBox list
		lstFonts.items.clear()
		-- Build a new ComboBox list using the view array
		lstFonts.items.addrange _fontsArr
	)
	on rlFonts open do collectFonts() --Fill on open
	on lstFonts DropDown do collectFonts() --Fill on expanding the list
	on lstFonts SelectedIndexChanged do (print lstFonts.text) --Command to execute on selecting the entry
)
createdialog rlFonts style:#(#style_SysMenu, #style_ToolWindow)
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 10 October 2012   #10
Response updating?

I've gone ahead and tried to use the construct to keep the Underline and Italic buttons updated upon the changing on the nodes or in the UI and it seems to be a bit wonky?
Hoping you guys could check it out.

Thanks


global textLister

struct singleTextPanel
(
	node,
	containerPnl,
	selectBtn,
	nameBox,
	italicBtn,
	underlineBtn,
	textBox,
	sizeLabel, 
	sizeNum, 
	kerningLabel,
	kerningNum, 
	leadingLabel, 
	leadingNum,
	fontList,
		
	panelHeight = 100,
	
	fn controlFactory type x y w h txt anchor: dock: =
	(
		local ctrl = dotNetObject type
		ctrl.bounds = dotNetObject "System.Drawing.Rectangle" x y w h
		ctrl.text = txt
		ctrl.tag = dotNetMxsValue this
		
		if anchor != unsupplied do ctrl.anchor = anchor
		if dock != unsupplied do ctrl.dock = dock
		
		ctrl
	),
	fn spinnerCtrlFactory type x y w h txt minV maxV val anchor: dock: =
	(
		local ctrl = dotNetObject type
		ctrl.bounds = dotNetObject "System.Drawing.Rectangle" x y w h
		ctrl.tag = dotNetMxsValue this
		ctrl.DecimalPlaces = 3
		ctrl.Increment = 0.05
 		ctrl.Value = val
 		ctrl.Minimum = minV
 		ctrl.Maximum = maxV		
		
		if anchor != unsupplied do ctrl.anchor = anchor
		if dock != unsupplied do ctrl.dock = dock
		
		ctrl
	),
	
	fn selectNode s e = select (s.tag.value.node),
	fn changeName s e = s.tag.value.node.name = s.text,
	fn changeText s e = s.tag.value.node.text = s.text,
	fn changeItalic s e = s.tag.value.node.italic = not s.tag.value.node.italic,
	fn changeUnderline s e = s.tag.value.node.underline = not s.tag.value.node.underline,
	fn changeSize s e = (
		local decimal = getProperty s #value asDotNetObject:true --will return a system.decimal object, not a maxscript value
		s.tag.value.node.size = (dotNetClass "System.Convert").ToSingle decimal --we use a dotnet converter class to convert the decimal to a float, which will correctly be cast to a maxscript float
	),
	fn changeKerning s e = (
		local decimal = getProperty s #value asDotNetObject:true --will return a system.decimal object, not a maxscript value
		s.tag.value.node.kerning = (dotNetClass "System.Convert").ToSingle decimal --we use a dotnet converter class to convert the decimal to a float, which will correctly be cast to a maxscript float
	),
	fn changeLeading s e = (
		local decimal = getProperty s #value asDotNetObject:true --will return a system.decimal object, not a maxscript value
		s.tag.value.node.leading = (dotNetClass "System.Convert").ToSingle decimal --we use a dotnet converter class to convert the decimal to a float, which will correctly be cast to a maxscript float
	),
		
	fn refreshFromNode = (
		nameBox.text = node.name
		textBox.text = node.text
		italicBtn.checked = node.italic
		underlineBtn.checked = node.underline
		sizeNum.value = node.size
		kerningNum.value = node.kerning
		leadingNum.value = node.leading
	),

	fn initialize form obj =
	(		
		node = obj
		
		local y = form.controls.count * panelHeight
		containerPnl = controlFactory "Panel" 0 y form.width panelHeight "" dock:(dotNetClass	"DockStyle").top
		
		selectBtn = controlFactory "Button" 10 10 20 20 "$"
		dotNet.addEventHandler selectBtn "Click" selectNode
		
		nameBox = controlFactory "MaxCustomControls.MaxTextBox" 35 10 100 20 obj.name
		dotNet.addEventHandler nameBox "TextChanged" changeName
		
		italicBtn = controlFactory "CheckBox" 35 35 20 20 "I"
		italicBtn.appearance = italicBtn.appearance.button
		italicBtn.Font = dotnetobject "system.drawing.font" (dotnetobject "system.drawing.fontfamily" "tahoma") 10  (dotNetClass "system.drawing.fontStyle").italic
		italicBtn.flatStyle=italicBtn.flatStyle.flat
		dotNet.addEventHandler italicBtn "CheckStateChanged" changeItalic
		
		underlineBtn = controlFactory "CheckBox" 60 35 20 20 "U"
		underlineBtn.appearance = underlineBtn.appearance.button
		underlineBtn.Font = dotnetobject "system.drawing.font" (dotnetobject "system.drawing.fontfamily" "tahoma") 10  (dotNetClass "system.drawing.fontStyle").bold 
		underlineBtn.flatStyle=underlineBtn.flatStyle.flat  
		dotNet.addEventHandler underlineBtn "CheckStateChanged" changeUnderline
		
		textBox = controlFactory "MaxCustomControls.MaxTextBox" 290 10 200 84 obj.text \
			anchor:(dotNet.combineEnums (dotNetClass "AnchorStyles").right (dotNetClass "AnchorStyles").left)
		textBox.multiline = true
		dotNet.addEventHandler textBox "TextChanged" changeText
		
		fontList = controlFactory "ComboBox" 140 10 145 20 obj.font
		--dotNetControl lstFonts "System.Windows.Forms.ComboBox" height:22
		
		
		sizeLabel = controlFactory "Label" 140 38 50 15 "Size:"
		sizeNum = spinnerCtrlFactory "NumericUpDown" 215 35 70 12 "Size" 0.0 99999999.9 obj.size
		dotNet.addEventHandler sizeNum "TextChanged" changeSize
		
		kerningLabel = controlFactory "Label" 140 58 50 15 "Kerning:"
		kerningNum = spinnerCtrlFactory "NumericUpDown" 215 55 70 12 "Kerning" -999999999.9 99999999.9 obj.kerning
		dotNet.addEventHandler kerningNum "TextChanged" changeKerning
		
		leadingLabel = controlFactory "Label" 140 78 50 15 "Leading:"
		leadingNum = spinnerCtrlFactory "NumericUpDown" 215 75 70 12 "Leading" -999999999.9 99999999.9 obj.leading
		dotNet.addEventHandler leadingNum "TextChanged" changeLeading
		
		containerPnl.controls.addRange #(selectBtn, nameBox, italicBtn, underlineBtn, textBox, sizeLabel, sizeNum, kerningLabel, kerningNum, leadingLabel, leadingNum,fontList)
	)

)

struct textListerStr
(
	dnFm = dotNetObject "maxCustomControls.MaxForm",
	panels = #(),
	
	fn initialize =
	(
		dnFm.text = "Text Lister"
		dnFm.bounds = dotNetObject "System.Drawing.Rectangle" 400 300 500 400
		local maxHwnd = dotNetObject "System.IntPtr" (windows.getMaxHwnd())
		local wrapper = dotNetObject "MaxCustomControls.Win32HandleWrapper" maxHwnd
			
		for t in getClassInstances text do
		(
			local node = (refs.dependentNodes t)[1]
			local pnl = singleTextPanel()
			pnl.initialize dnFm node
			dnFm.controls.add pnl.containerPnl
			append panels pnl
			
			deleteAllChangeHandlers id:#textLister
			when parameters node change id:#textLister obj do (			 
				for p in textLister.panels where p.node == obj do p.refreshFromNode()
			)
			when name node change  id:#textLister do (
				for p in textLister.panels where p.node == obj do p.refreshFromNode()
			)
			
		)
		dnFm.show wrapper
	),
	
	_init = initialize()
)

textLister = textListerStr()
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 10 October 2012   #11
Originally Posted by JokerMartini: Thank you very much miauu that is great.

Now does anyone have a recommended method for doing an efficient "color picker" method for dotnet. I want to display the wirecolor of each object in the panel, but also still give the functionality of changing the color to the user as well.


Use a simple button or a panel and set its backcolor property to the color of the object.

For changing the color either use the dotnet ColorDialog class, or better yet, the maxscript colorPickedDlg function:

colorPickerDlg <init_color> <title_string> alpha:<bool> pos:<&Point2>
 
Old 10 October 2012   #12
deleteAllChangeHandlers id:#textLister


This should be before the loop! The way you have it now, only the last handler is not deleted.
 
Old 10 October 2012   #13
I fixed the button but it still seems to act up if you change the state of the underline on the object and the panel. It doesn't seem to know what to do.


global textLister

struct singleTextPanel
(
	node,
	containerPnl,
	selectBtn,
	nameBox,
	italicBtn,
	underlineBtn,
	textBox,
	sizeLabel, 
	sizeNum, 
	kerningLabel,
	kerningNum, 
	leadingLabel, 
	leadingNum,
	fontList,
		
	panelHeight = 100,
	
	fn controlFactory type x y w h txt anchor: dock: =
	(
		local ctrl = dotNetObject type
		ctrl.bounds = dotNetObject "System.Drawing.Rectangle" x y w h
		ctrl.text = txt
		ctrl.tag = dotNetMxsValue this
		
		if anchor != unsupplied do ctrl.anchor = anchor
		if dock != unsupplied do ctrl.dock = dock
		
		ctrl
	),
	fn spinnerCtrlFactory type x y w h txt minV maxV val anchor: dock: =
	(
		local ctrl = dotNetObject type
		ctrl.bounds = dotNetObject "System.Drawing.Rectangle" x y w h
		ctrl.tag = dotNetMxsValue this
		ctrl.DecimalPlaces = 3
		ctrl.Increment = 0.05
 		ctrl.Value = val
 		ctrl.Minimum = minV
 		ctrl.Maximum = maxV		
		
		if anchor != unsupplied do ctrl.anchor = anchor
		if dock != unsupplied do ctrl.dock = dock
		
		ctrl
	),
	
	fn selectNode s e = select (s.tag.value.node),
	fn changeName s e = s.tag.value.node.name = s.text,
	fn changeText s e = s.tag.value.node.text = s.text,
	fn changeItalic s e = s.tag.value.node.italic = not s.tag.value.node.italic,
	fn changeUnderline s e = s.tag.value.node.underline = not s.tag.value.node.underline,
	fn changeSize s e = (
		local decimal = getProperty s #value asDotNetObject:true --will return a system.decimal object, not a maxscript value
		s.tag.value.node.size = (dotNetClass "System.Convert").ToSingle decimal --we use a dotnet converter class to convert the decimal to a float, which will correctly be cast to a maxscript float
	),
	fn changeKerning s e = (
		local decimal = getProperty s #value asDotNetObject:true --will return a system.decimal object, not a maxscript value
		s.tag.value.node.kerning = (dotNetClass "System.Convert").ToSingle decimal --we use a dotnet converter class to convert the decimal to a float, which will correctly be cast to a maxscript float
	),
	fn changeLeading s e = (
		local decimal = getProperty s #value asDotNetObject:true --will return a system.decimal object, not a maxscript value
		s.tag.value.node.leading = (dotNetClass "System.Convert").ToSingle decimal --we use a dotnet converter class to convert the decimal to a float, which will correctly be cast to a maxscript float
	),
		
	fn refreshFromNode = (
		nameBox.text = node.name
		textBox.text = node.text
		italicBtn.checked = node.italic
		underlineBtn.checked = node.underline
		sizeNum.value = node.size
		kerningNum.value = node.kerning
		leadingNum.value = node.leading
	),

	fn initialize form obj =
	(		
		node = obj
		
		local y = form.controls.count * panelHeight
		containerPnl = controlFactory "Panel" 0 y form.width panelHeight "" dock:(dotNetClass	"DockStyle").top
		
		selectBtn = controlFactory "Button" 10 10 20 20 "$"
		dotNet.addEventHandler selectBtn "Click" selectNode
		
		nameBox = controlFactory "MaxCustomControls.MaxTextBox" 35 10 100 20 obj.name
		dotNet.addEventHandler nameBox "TextChanged" changeName
		
		italicBtn = controlFactory "CheckBox" 35 35 20 20 "I"
		italicBtn.appearance = italicBtn.appearance.button
		italicBtn.Font = dotnetobject "system.drawing.font" (dotnetobject "system.drawing.fontfamily" "tahoma") 10  (dotNetClass "system.drawing.fontStyle").italic
		italicBtn.flatStyle=italicBtn.flatStyle.flat
		dotNet.addEventHandler italicBtn "CheckStateChanged" changeItalic
		
		underlineBtn = controlFactory "CheckBox" 60 35 20 20 "U"
		underlineBtn.appearance = underlineBtn.appearance.button
		underlineBtn.Font = dotnetobject "system.drawing.font" (dotnetobject "system.drawing.fontfamily" "tahoma") 10  (dotNetClass "system.drawing.fontStyle").bold 
		underlineBtn.flatStyle=underlineBtn.flatStyle.flat  
		dotNet.addEventHandler underlineBtn "CheckStateChanged" changeUnderline
		
		textBox = controlFactory "MaxCustomControls.MaxTextBox" 290 10 200 84 obj.text \
			anchor:(dotNet.combineEnums (dotNetClass "AnchorStyles").right (dotNetClass "AnchorStyles").left)
		textBox.multiline = true
		dotNet.addEventHandler textBox "TextChanged" changeText
		
		fontList = controlFactory "ComboBox" 140 10 145 20 obj.font
		--dotNetControl lstFonts "System.Windows.Forms.ComboBox" height:22
		
		
		sizeLabel = controlFactory "Label" 140 38 50 15 "Size:"
		sizeNum = spinnerCtrlFactory "NumericUpDown" 215 35 70 12 "Size" 0.0 99999999.9 obj.size
		dotNet.addEventHandler sizeNum "TextChanged" changeSize
		
		kerningLabel = controlFactory "Label" 140 58 50 15 "Kerning:"
		kerningNum = spinnerCtrlFactory "NumericUpDown" 215 55 70 12 "Kerning" -999999999.9 99999999.9 obj.kerning
		dotNet.addEventHandler kerningNum "TextChanged" changeKerning
		
		leadingLabel = controlFactory "Label" 140 78 50 15 "Leading:"
		leadingNum = spinnerCtrlFactory "NumericUpDown" 215 75 70 12 "Leading" -999999999.9 99999999.9 obj.leading
		dotNet.addEventHandler leadingNum "TextChanged" changeLeading
		
		containerPnl.controls.addRange #(selectBtn, nameBox, italicBtn, underlineBtn, textBox, sizeLabel, sizeNum, kerningLabel, kerningNum, leadingLabel, leadingNum,fontList)
	)

)

struct textListerStr
(
	dnFm = dotNetObject "maxCustomControls.MaxForm",
	panels = #(),
	
	fn initialize =
	(
		dnFm.text = "Text Lister"
		dnFm.bounds = dotNetObject "System.Drawing.Rectangle" 400 300 500 400
		local maxHwnd = dotNetObject "System.IntPtr" (windows.getMaxHwnd())
		local wrapper = dotNetObject "MaxCustomControls.Win32HandleWrapper" maxHwnd
			
		deleteAllChangeHandlers id:#textLister	
			
		for t in getClassInstances text do
		(
			local node = (refs.dependentNodes t)[1]
			local pnl = singleTextPanel()
			pnl.initialize dnFm node
			dnFm.controls.add pnl.containerPnl
			append panels pnl
			
			when parameters node change id:#textLister obj do (			 
				for p in textLister.panels where p.node == obj do p.refreshFromNode()
			)
			when name node change  id:#textLister do (
				for p in textLister.panels where p.node == obj do p.refreshFromNode()
			)
			
		)
		dnFm.show wrapper
	),
	
	_init = initialize()
)

textLister = textListerStr()
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 10 October 2012   #14
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:47 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.