Another bugger is that I can not multi-line select by click and drag. It wants to select only a single object in the list.
Don’t click on the text and drag, click on the open line beside the text and drag and it will work as it should.
if FullRowSelect property set to TRUE you have to click in empty cell (subitem) to be able select with drag.
It seems like in this case the easiest route to go is to just stick with the maxscript ui.
There is just basic functionalities that come with it that I like and for what I need it seems like more work than necessary at the moment to use dotNet.
I appreciate the help and explanation of things.
I’m trying to create and Image button using dotNet since the max imageButtons and ImgTags seem a bit funky.
What I’m trying to do is take a strip of icons along with the alpha, and change out the bitmap based on button conditions.
All the buttons icons are in one strip.
I’m not sure how to offset the image on button being enabled/disabled.
In this case there are four images.
I want the button to be an image-checkbutton
So when the user clicks the button its image changes to a different image. I think once I see how one example works I’ll be able to figure out the rest of them.
try(destroyDialog ::rlImages)catch()
rollout rlImages "Image Buttons"
(
.........
)
createdialog rlImages 100 100 style:#(#style_SysMenu, #style_ToolWindow)
I tried using just mxs
but the ImgTag seems to yield some odd results.
The reason I don’t use the default max button is because it leaves an ugly border around the button which I dont want. Which leaves me with imgTag or something dotNet to use.
try(destroyDialog rlPipeGen)catch()
rollout rlPipeGen "Pipes Generator"
(
local iconDir = "Q:\USERS\JokerMartini\Projects\Maxscripts\JokerMartini\\morphControlBoard\\icons\\"
ImgTag ImgTag_BG bitmap:(openBitmap (iconDir + "icons.bmp")) pos:[0,0] width:32 height:32 opacity:1 transparent:(color 0 255 255) enabled:off
)
createDialog rlPipeGen 150 150 style:#(#style_SysMenu, #style_ToolWindow)
here is what you have to do:
#1 create Bitmap object from you icon file
#2 create ImageList
#3 using Bitmap Clone method with location and size arguments create new Bitmaps and add them to the ImageList
#4 assign the ImageList to the button’s ImageList
#5 using CheckedChanged event change buttons ImageIndex or ImageKey
Not entirely sure how i go about doing all that as I’m not super familiar with dotNet but this is what I’ve got together by combining some other scripts.
try(destroyDialog ::rlImages)catch()
rollout rlImages "Image Buttons"
(
local icons = "Q:\USERS\JokerMartini\Projects\Maxscripts\JokerMartini\\morphControlBoard\\icons\\pinDisabled.png"
--//Variables
---------------------------------------------------
local theFont = dotnetobject "System.Drawing.Font" "Arial" 9
fn imgButtonFactory ctrl img = --//dotNet image buttons
(
local theBut = ctrl
theBut.Font = theFont
theBut.flatStyle=theBut.flatStyle.flat
theBut.flatAppearance.BorderSize = 0
--theBut.BackColor = (dotNetClass "System.Drawing.Color").fromARGB 200 200 200
--theBut.ForeColor = (dotNetClass "System.Drawing.Color").fromARGB 31 29 28
theBut.flatappearance.mouseoverbackcolor = (dotNetClass "System.Drawing.Color").fromARGB 0 255 0
theBut.flatappearance.mousedownbackcolor = (dotNetClass "System.Drawing.Color").fromARGB 255 0 0
theBut.TextAlign = theBut.TextAlign.MiddleCenter
theBut.Text = ""
theBut.image = (dotNetclass "System.Drawing.image").fromfile img
theBut.ImageAlign = theBut.ImageAlign.MiddleCenter
theBut
)
dotNetControl btnAddJobName "button" pos:[5,5] width:32 height:32
on rlImages open do
(
ctrlImgButtons = #(btnAddJobName)
for i = 1 to ctrlImgButtons.count do imgButtonFactory ctrlImgButtons[i] icons
)
)
createdialog rlImages 100 100 style:#(#style_SysMenu, #style_ToolWindow)
http://forums.cgsociety.org/showpost.php?p=5993688&postcount=5
that’s some reference
i’l try to find another
well … there is another one http://msdn.microsoft.com/en-us/library/ms141944.aspx
after that… go on yours own
Special Thanks to Rotem
rollout rlImages "Image Buttons"
(
local imgStrip = (dotnetClass "System.Drawing.Image").fromFile @"C:\icons.jpg"
dotNetControl btnAddJobName "button" pos:[5,5] width:32 height:32
on btnAddJobName click do
(
btnAddJobName.tag += 1
if btnAddJobName.tag == 4 do btnAddJobName.tag = 0
btnAddJobName.Invalidate()
)
on rlImages open do
(
btnAddJobName.tag = 0
)
on btnAddJobName paint s e do
(
if (classof btnAddJobName.tag == integer) then --protect against painting before 'on rlImages open' has executed
(
local imgPoint = dotNetObject "System.Drawing.Rectangle" (btnAddJobName.tag * -32) 0 128 32
e.graphics.drawImage imgStrip imgPoint
)
)
)
createdialog rlImages 100 100 style:#(#style_SysMenu, #style_ToolWindow)
I checked it. It is about twice as slow as specifying an .image property, yet it is exactly the same speed as manually painting a single 32X32 image.
The difference is around 300ms for 1000 iterations = 0.3ms difference per paint per button. Unless you have dozens of these buttons I don’t think you will notice a difference.
If you really need this kind of performance with that many controls, you wouldn’t be using a max rollout anyways.
Btw, it’s exactly the same performance as your code