You are here: PSPad forum > English discussion forum > Set tab colour from script?

Set tab colour from script?

#1 Set tab colour from script?

Posted by: DonQuichote | Date: 06/20/2017 11:12 | IP: IP Logged

Is it possible to set the tab colours from a script? When developing web sites, I have a lot of files open and I use the tab colour feature a lot. It would be nice if I could write a script that checks the directory and the file type, and set the tab colour accordingly.

Options: Reply | Quote | Up ^


#2 Re: Set tab colour from script?

Posted by: pspad | Date: 06/20/2017 11:33 | IP: IP Logged

It's not possible now, but I can add support for it.
In the next build.

Options: Reply | Quote | Up ^


#3 Re: Set tab colour from script?

Posted by: DonQuichote | Date: 06/20/2017 12:50 | IP: IP Logged

That would be great! Thank you.

Options: Reply | Quote | Up ^


#4 Re: Set tab colour from script?

Posted by: DonQuichote | Date: 08/16/2017 13:55 | IP: IP Logged

Dear Jan,

I was trying the newly added tabColor function, and though I can query the current tab colour, I cannot seem to set one. I used the following piece of VBScript code to test the function:

Sub ColourTabs
Dim intIndex, objEditor
Set objEditor = NewEditor()
For intIndex = 0 To editorsCount - 1
objEditor.assignEditorByIndex(intIndex)
objEditor.activate
MsgBox(objEditor.tabColor())
objEditor.tabColor("C0C0C0")
Next
End Sub

This function walks through all the open tabs, displays a message box with the tab's current colour, and then set it to light grey. Only the tabs do not turn the grey colour, although when I right-click them to set the colour manually, the colour seems to be set. Just not visibly.

Did I overlook something?

Options: Reply | Quote | Up ^


#5 Re: Set tab colour from script?

Posted by: vbr | Date: 08/16/2017 14:53 | IP: IP Logged

Hi, I can confirm some problems with the scripting function tabColor(...)
Using simple javascript test function, it seems, that the tab color is set internally but the tab itself is not visibly colored. However, the newly set color is displayed in the dialog for manual color setting (and is actually used, if I only confirm this dialog).

Maybe some refresh or initialisation is missing - if I first use manual color setting, then call the script with tabColor(...) and finally move the mouse focus to another tab, the previously set color via scripting is actually shown.
(Pspad 5, 243; Win7, without theming/"classic" XP theme, if it is relevant)
regards,
vbr

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2017 Jan Fiala
Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák