Notifications
Clear all
[Closed] PLEASE help me do It Better! Info TABLO
Aug 07, 2015 8:01 am
Many times I want to be informed about smth, but I don’t want to press any button because of it.
Lets say I want to be informed that I have 7 missing textures, or smth else.
I made an InfoTablo which smootly appears and dissapears.
(
if CollectInformationForm!=undefined do try(CollectInformationForm.close())catch()
--======================== VARIABLES =====================================
local displayTime = 75
local informming_tablo_text = ""
local stopprev = false
local CollectInformationForm
local dnLabel
local net_tm = dotnetobject "Timer"; net_tm.Interval = 30
local counter=0
fn defFontB fName fSize = (dotNetObject "System.Drawing.Font" fName fSize ((dotNetClass "System.Drawing.FontStyle").bold))
Local Font = (defFontB "Verdana" 8)
--======================== FUNCTIONS =====================================
fn defSize x y = (dotNetObject "System.Drawing.Size" x y)
fn defPoint x y = (dotNetObject "System.Drawing.Point" x y)
fn maxHW =
(
thePtr = DotNetObject "System.IntPtr" (Windows.GetMAXHWND())
if 1998+((maxversion())[1]/1000)>2014 then
(dotnetclass "System.Windows.Forms.Control").fromHandle thePtr
else
DotNetObject "MaxCustomControls.Win32HandleWrapper" thePtr
)
fn defForm dnForm = --main form
(
dnForm.Opacity=0
dnForm.ShowInTaskbar = false ;
dnForm.Text = "" ;
dnForm.ClientSize = defSize 400 50
dnForm.StartPosition = dnForm.StartPosition.Manual ; dnForm.DesktopLocation = defPoint 3 128
dnForm.FormBorderStyle = dnForm.FormBorderStyle.None
)
fn createInfoTablo =
(
CollectInformationForm=dotNetObject "form"
defForm CollectInformationForm
dnLabel=dotNetObject "label"
dnLabel.Font = Font
dnLabel.bounds=dotNetObject "system.drawing.rectangle" 10 15 300 100
CollectInformationForm.controls.add dnLabel
dotNet.setLifeTimeControl CollectInformationForm #dotNet
CollectInformationForm.Show (maxHW())
)
fn onTick1 s a =
(
if counter < 20 then
CollectInformationForm.Opacity+=0.05
if counter > displayTime-20 then
CollectInformationForm.Opacity-=0.05
if counter < displayTime then
(
counter+=1
)
else
(
s.Stop()
counter=0
if stopprev then
(
s.Start()
stopprev = false
dnLabel.text=informming_tablo_text
)
else dnLabel.text=""
)
)
dotnet.addEventHandler net_tm "Tick" onTick1
fn call_information_tablo text_info text_info2: =
(
informming_tablo_text = text_info
if counter!=0 then
(
stopprev = true
)
else
(
net_tm.Start()
dnLabel.text = informming_tablo_text
)
if text_info2 != unsupplied then
(
stopprev = true
informming_tablo_text = text_info2
)
)
createInfoTablo()
call_information_tablo "Some Data.." --text_info2:"Some Other Data"
)
I like the way it works, but after(durring) running it, when Max is busy (when loading a big max file, or a heavy script process is running) this window appears if even it was not called, so opacity becomes 1 unfortunatelly
1 Reply
Aug 07, 2015 8:01 am
(
if CollectInformationForm!=undefined do try(CollectInformationForm.close())catch()
--======================== VARIABLES =====================================
local displayTime = 75
local informming_tablo_text = ""
local stopprev = false
local CollectInformationForm
local dnLabel
local net_tm = dotnetobject "Timer"; net_tm.Interval = 30
local counter=0
fn defFontB fName fSize = (dotNetObject "System.Drawing.Font" fName fSize ((dotNetClass "System.Drawing.FontStyle").bold))
Local Font = (defFontB "Verdana" 8)
--======================== FUNCTIONS =====================================
fn defSize x y = (dotNetObject "System.Drawing.Size" x y)
fn defPoint x y = (dotNetObject "System.Drawing.Point" x y)
fn maxHW =
(
thePtr = DotNetObject "System.IntPtr" (Windows.GetMAXHWND())
if 1998+((maxversion())[1]/1000)>2014 then
(dotnetclass "System.Windows.Forms.Control").fromHandle thePtr
else
DotNetObject "MaxCustomControls.Win32HandleWrapper" thePtr
)
fn defForm dnForm = --main form
(
dnForm.Opacity=0
dnForm.ShowInTaskbar = false ;
dnForm.Text = "" ;
dnForm.ClientSize = defSize 400 50
dnForm.StartPosition = dnForm.StartPosition.Manual ; dnForm.DesktopLocation = defPoint 3 128
dnForm.FormBorderStyle = dnForm.FormBorderStyle.None
)
fn createInfoTablo =
(
CollectInformationForm=dotNetObject "form"
defForm CollectInformationForm
dnLabel=dotNetObject "label"
dnLabel.Font = Font
dnLabel.bounds=dotNetObject "system.drawing.rectangle" 10 15 300 100
CollectInformationForm.controls.add dnLabel
dotNet.setLifeTimeControl CollectInformationForm #dotNet
CollectInformationForm.Show (maxHW())
)
fn onTick1 s a =
(
if counter < 20 then
CollectInformationForm.Opacity+=0.05
if counter > displayTime-20 then
CollectInformationForm.Opacity-=0.05
if counter < displayTime then
(
counter+=1
)
else
(
s.Stop()
counter=0
if stopprev then
(
s.Start()
stopprev = false
dnLabel.text=informming_tablo_text
)
else
(
--dnLabel.text=""
if CollectInformationForm!=undefined do try(CollectInformationForm.close())catch()
)
)
)
dotnet.addEventHandler net_tm "Tick" onTick1
fn call_information_tablo text_info text_info2: =
(
informming_tablo_text = text_info
if counter!=0 then
(
stopprev = true
)
else
(
createInfoTablo()
net_tm.Start()
dnLabel.text = informming_tablo_text
)
if text_info2 != unsupplied then
(
stopprev = true
informming_tablo_text = text_info2
)
)
--createInfoTablo()
call_information_tablo "Some Data.." text_info2:"Some Other Data.."
)
Anyway, if you have a better Idea, you’re welcome to Edit it.