Notifications
Clear all

[Closed] Does anyone have the same problem?

I like to have many scripts opened at same time in my Editor. Many means really many. Sometimes I have 50+ scripts opened. Why?
My usual project is 5-10 modules. I can work on 2-3 projects at the same time…
Some library scripts are there … it’s plus another 5-10…
5-10 scripts to change a focus when I stuck with my main task…
5-10 scripts which might be useful at any time.
5-10 favorite scripts on tap just in case…

and the problem is – I can’t find the script that I’m currently looking for in TAB CONTROL menu of the Editor. The top menu gives me only 10 scripts in a very stupid order. After I select any script the editor reorders all scripts in a chaotic way.
If I am not alone with my problem I like to share some solution…

6 Replies

I wish there was a vertical option for tabs or a list view. I
Can get alot Scripts open too

Yes, I’m on the same boat, hehe… so I will glad to see your solution, thanks in advance.

Hi,

Hehe at last I can give an answer to Denis
Easy solution:
Edit ‘MXS_Editor.properties’

tabbar.multiline=1
  buffers=50
  

‘buffers’ is the max number of opened files at the same time

Cheers

before i show some solution that helps me find a tab, play with this little toy, and see how easy it is:


 global ChaseMeDialog
try(ChaseMeDialog.close()) catch()
(
	fn getRandomList count seedvalue: = 
	(
		subs = #() 	
		subs.count = count
		if iskindof seedvalue number do seed seedvalue
		for i = 1 to count do 
		(
			k = random 1 i
			subs[i] = subs[k]
			subs[k] = i
		)
		subs
	)
		
	form = dotnetobject "Form"
	form.StartPosition = form.StartPosition.Manual
	form.Size = dotnetobject "System.Drawing.Size" 900 300
	form.MinimumSize = dotnetobject "System.Drawing.Size" 650 200
	form.Location = dotnetobject "System.Drawing.Point" 500 150
	form.Text = "C'mon chase me! Try and catch me!"
	form.DockPadding.All = 1

	tb = dotnetobject "TabControl"
	tb.ItemSize = dotnetobject "System.Drawing.Size" 30 18
	tb.Multiline = on
	tb.Backcolor = tb.Backcolor.Transparent
	tb.SizeMode = tb.SizeMode.FillToRight
	tb.Dock = tb.Dock.Fill

	NumberTabs = 30
	fn getFileNames num:NumberTabs seedvalue: = 
	(
		files = #()
		join files (getFiles (getDir #maxroot + @"stdplugs\stdscripts\*.ms"))	
		join files (getFiles (getDir #maxroot + @"maps\fx\*.fx"))	
		join files (getFiles (getDir #maxroot + @"ui\macroscripts\*.mcr"))	
		
		randIDs = getRandomList files.count seedvalue:seedvalue
		randIDs.count = num

		for k=1 to num collect (filenamefrompath files[randIDs[k]])
	)

	pn = dotnetobject "UserControl"
	pn.BorderStyle = pn.BorderStyle.FixedSingle
	pn.Size = dotnetobject "System.Drawing.Size" 990 23
	pn.Backcolor = pn.Backcolor.LightGray
	pn.Dock = pn.Dock.Top

	fn onTimerTick s e = 
	(
		s.tag.text = ((dotnetclass "System.DateTime").Now.Subtract s.tag.tag).Seconds as string
	)
	fn resetTimer s = 
	(
		s.Stop()
		s.tag.text = 0 as string
	)
	fn restartTimer s = 
	(
		s.tag.tag = (dotnetclass "System.DateTime").Now
		s.Start()
	)
	tt = dotnetobject "Timer"
	tt.Interval = 200
	dotnet.addEventHandler tt "Tick" onTimerTick

	fn onSelectedItem s e = 
	(
		p = s.TopLevelControl.Controls.Item[1].Controls.Item[0]
		t = s.TopLevelControl.Controls.Item[1].Controls.Item[1]
		h = s.TopLevelControl.Controls.Item[1].Controls.Item[2]
		
		if e.TabPage.Text == s.tag then
		(
			e.TabPage.Backcolor = e.TabPage.Backcolor.MistyRose
			h.Text = t.Text
			(dotnetclass "System.Media.SystemSounds").Exclamation.Play() -- hit
			resetTimer s.TopLevelControl.tag
			p.Text = s.tag = s.TabPages.Item[random 0 (s.TabCount-1)].Text
			restartTimer s.TopLevelControl.tag
		)
		else
		(
			e.TabPage.Backcolor = e.TabPage.Backcolor.RosyBrown
			(dotnetclass "System.Media.SystemSounds").Hand.Play() -- miss
		)
		-- format ">> % == %
" e.TabPage.Text s.tag
	)	
	dotnet.addEventHandler tb "Selected" onSelectedItem

	bt_names = #("Default Game", "Random Game", "Skip")
	fn startGame s type:0 num:NumberTabs =
	(
		resetTimer s.TopLevelControl.tag
		t = s.TopLevelControl.Controls.Item[0]
		dotnet.removeAllEventHandlers t
		p = s.TopLevelControl.Controls.Item[1].Controls.Item[0]
		if type < 3 do
		(
			files = getFileNames num:num seedvalue:(if type < 2 do 0x1967)

			t.Hide()
			if type == 0 do
			(
				t.TabPages.Clear()
				for k=1 to NumberTabs do 
				(
					tp = dotnetobject "TabPage"
					tp.Backcolor = tp.Backcolor.RosyBrown
					t.TabPages.Add tp
				)
			)
			for k=0 to t.TabCount-1 do t.TabPages.Item[k].Text = files[k+1]
			t.Show()
		)
		p.Text = t.tag = t.TabPages.Item[random 0 (t.TabCount-1)].Text
	--	format "% % %
" type t p
		dotnet.addEventHandler t "Selected" onSelectedItem
		if type > 0 do restartTimer s.TopLevelControl.tag
	)
	fn onMouseClick s e =
	(
		case s.tag of
		(
			1: startGame s type:s.tag
			2: startGame s type:s.tag
			3: startGame s type:s.tag
		)
	)
	bts = for k=bt_names.count to 1 by -1 collect
	(
		bt = dotnetobject "Button"
		bt.AutoSize = on
		--bt.Width = 90
		bt.Backcolor = bt.Backcolor.Transparent
		bt.Text = bt_names[k]
		bt.tag = k
		bt.Dock = bt.Dock.Left
		dotnet.addEventHandler bt "MouseClick" onMouseClick
		bt
	)
	np = dotnetobject "TextBox"
	np.TextAlign = np.TextAlign.Center 
	np.ReadOnly = on
	np.Backcolor = np.Backcolor.AntiqueWhite
	np.Dock = np.Dock.Fill

	tp = dotnetobject "TextBox"
	tp.ReadOnly = on
	tp.Width = 40
	tp.Backcolor = tp.Backcolor.RosyBrown
	tp.Dock = tp.Dock.Right

	ht = dotnetobject "TextBox"
	ht.ReadOnly = on
	ht.Width = 40
	ht.Backcolor = ht.Backcolor.MistyRose
	ht.Dock = ht.Dock.Right

	fn onStopClick s e =
	(
		s.TopLevelControl.tag.Stop()
	)
	bt = dotnetobject "Button"
	bt.Text = "Stop"
	bt.Width = 60
	bt.Backcolor = bt.Backcolor.Transparent
	bt.Dock = tp.Dock.Right
	dotnet.addEventHandler bt "MouseClick" onStopClick

	fn onSelectedIndexChanged s e =
	(
		NumberTabs = s.SelectedItem as integer
		startGame s num:NumberTabs type:0
	)	
	cc = dotnetobject "ComboBox"
	cc.Width = 50
	cc.DropDownStyle = cc.DropDownStyle.DropDownList
	cc.Dock = cc.Dock.Left
	cc.Items.AddRange #("10","20","30","40","50","60")
	cc.SelectedIndex = 2
	dotnet.addEventHandler cc "SelectedIndexChanged" onSelectedIndexChanged

	pn.Controls.add np
	pn.Controls.add tp
	pn.Controls.add ht
	pn.Controls.add bt
	pn.Controls.addrange bts
	pn.Controls.add cc

	tt.tag = tp

	form.Controls.addrange #(tb, pn)
	form.tag = tt

	startGame tb num:NumberTabs type:0

	form.show (dotnetobject "MaxCustomControls.Win32HandleWrapper" (dotnetobject "IntPtr" (windows.getmaxhwnd())))
	ChaseMeDialog = form
)
 

rules are simple… start a new game and try find the tab page by the asked text…
default game sets always the same list and order of files…
random game makes a random list…
you can change the number of tab pages, and skip asked by pressing skip

also i hope it will help someone to work with dotnet forms and its events. Enjoy!

1 Reply
(@jsnb)
Joined: 10 months ago

Posts: 0

Oh god… the pain – the game is tedious – and played everyday. Thanks for sharing this code example.

The other problem I have is that even if you find the tab; once selected, it is difficult to know that it is selected. When I have a lot of scripts open in the editor I select a tab – and the script view updates – but so does the tab view. It appears to be a random change in the ordering of the tabs.