His PC is probably still in warranty:). Ask him
I guess this is not offended you. Sorry again.
The TurboSquid specification for CheckMate contest was support for max7 and up.
Good news.
The code from Branko works with one little modification – I replaced
bgaFORM.Show (maxHW())
with
bgaFORM.show()
Thank you, Branko.
Yep, tested on Win7 64bit, max9 32 bit and windows2000, max9. The windows2000 have dotNet 1.1 i think. DotNet 2.0 is not installed.
The main problem now is that when I press Browse button and then press OK button to close the save file dialog the save file dialog is runing again and again? How to solve this?
The scripts have LOAD button, that loads single file. I use dotNEt open file dialog, but the problems occurs with it too – pressing ENTER to close the dialog and to load the file run the Open File Dialog again.
gazybara’s code was right but let’s do it a little cleaner
try(form.Close()) catch()
(
global form = dotnetobject "MaxCustomControls.MaxForm"
form.Text = "TAB stop, ENTER press..."
fn makeButton name =
(
bt = dotnetobject "Button"
bt.Text = name
bt.Dock = bt.Dock.Top
fn onKeyDown s e = case e.KeyCode of
(
(e.KeyCode.Tab): s.TopLevelControl.SelectNextControl s (s.ModifierKeys == s.ModifierKeys.Shift) on on on
)
fn onKeyUp s e = case e.KeyCode of
(
(e.KeyCode.Enter): s.PerformClick()
)
fn onClick s e =
(
format "click \"%\"
" s.text
)
dotnet.addEventHandler bt "KeyUp" onKeyUp
dotnet.addEventHandler bt "KeyDown" onKeyDown
dotnet.addEventHandler bt "Click" onClick
bt
)
bt1 = makeButton "Button 1"
bt2 = makeButton "Button 2"
bt3 = makeButton "Button 3"
bt4 = makeButton "Button 4"
form.Controls.AddRange #(bt4, bt3, bt2, bt1)
form.ShowModeless()
bt1.Focus()
)
here is the version with open file dialog (max):
try(form.Close()) catch()
(
global form = dotnetobject "MaxCustomControls.MaxForm"
form.Text = "TAB stop, ENTER press..."
fn makeButton name click: =
(
bt = dotnetobject "Button"
bt.Text = name
bt.Dock = bt.Dock.Top
fn onKeyDown s e = case e.KeyCode of
(
(e.KeyCode.Tab): s.TopLevelControl.SelectNextControl s (s.ModifierKeys == s.ModifierKeys.Shift) on on on
)
fn onClick s e =
(
format "click \"%\"
" s.text
)
dotnet.addEventHandler bt "KeyDown" onKeyDown
dotnet.addEventHandler bt "Click" (if click == unsupplied then onClick else click)
bt
)
fn onEnterKeyDown s e = case e.KeyCode of
(
(e.KeyCode.Enter):
(
s.PerformClick()
)
)
fn openFileName s e =
(
getOpenFilename()
s.Focus()
)
bt1 = makeButton "Button 1"
bt2 = makeButton "Button 2"
bt3 = makeButton "Button 3"
bt4 = makeButton "Open" click:openFileName
dotnet.addEventHandler bt4 "KeyDown" onEnterKeyDown
form.controls.AddRange #(bt4, bt3, bt2, bt1)
form.showmodeless()
bt1.Focus()
)
Denis, thenk you. I solve the problem with infinite opening of the Load and Save file dialogs using
nextControl.setFocus()
Now I will examine your code.
Another question – I suppose that dotnet forms do not have
on rollout open do
event, so to simulate this I have to put the code before
theForm.Show()
or there is another way?
For this you can use
--"on rollout open do" is the same as form "load"event
dotnet.addeventhandler theForm "Load" (fn onLoad s e = (--your code))
--"on rollout close do" is the same as form "FormClosed"event
dotnet.addeventhandler theForm "FormClosed" (fn onClosed s e = (--your code))
for .net windows forms you have to use Shown and Closing (or Closed) events:
try(form.Close()) catch()
(
global form = dotnetobject "MaxCustomControls.MaxForm"
form.Text = "TAB stop, ENTER press..."
fn onClosing s e =
(
format "closing \"%\"
" s.text
)
dotnet.addEventHandler form "Closing" onClosing
fn onShown s e =
(
format "shown \"%\"
" s.text
)
dotnet.addEventHandler form "Shown" onShown
form.showmodeless()
)