How to Refresh Columns Header OnScriptConfigChange?

[code]option explicit

' Modified and Created
' 球球
'
' This is a script for Directory Opus.
' See http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts for development information.
'
'
'
' Called by Directory Opus to initialize the script

Function OnInit(initData)
DOpus.Output ("Add Modified and Created Column Initializing...")
initData.name = "Modified and Created Column"
initData.desc = "Add Modified and Created Column."
initData.copyright = "球球"
initData.version = "0.1"
initData.default_enable = false

initData.config.Item_MinuteText = " 分钟前"
initData.config.Item_HourText = " 小时前"
initData.config.Item_DayText = " 天 前"
initData.config.Item_MonthText = " 个月前"
initData.config.Item_YearText = " 年 前"

initData.config.Column_CreateHeader = "创建于"
initData.config.Column_ModifyHeader = "修改于"
Dim col

Set col = initData.AddColumn
col.name = "Created"
col.method = "OnCreated"
col.label = "Created"
col.justify = "Right"
col.Header = initData.config.Column_CreateHeader
col.autogroup = true

col.autorefresh = true

Set col = initData.AddColumn
col.name = "Modified"
col.method = "OnModified"
col.label = "Modified"
col.Header = initData.config.Column_ModifyHeader
col.justify = "Right"
col.autogroup = true

col.autorefresh = true
End Function

Function OnScriptConfigChange(configChangeData)
'how to Refresh Columns Header
End Function

' Implement the Created column
Function OnCreated(scriptColData)
GetInterval(scriptColData)
End Function

' Implement the Modified column
Function OnModified(scriptColData)
GetInterval(scriptColData)
End Function

Function GetInterval(scriptColData)
dim mYear, mMonth, mDay, mWeek, mHour, mMinute
mYear = DateDiff("yyyy",scriptColData.item.modify, Now())
mMonth = DateDiff("m",scriptColData.item.modify, Now())
mDay = DateDiff("d",scriptColData.item.modify, Now())
mHour = DateDiff("h",scriptColData.item.modify, Now())
mMinute = DateDiff("n",scriptColData.item.modify, Now())

If mMinute < 60 then
scriptColData.value = mMinute & Script.config.Item_MinuteText
scriptColData.sort = 1
ElseIf mMinute >= 60 and mHour < 24 then
scriptColData.value = mHour & Script.config.Item_HourText
scriptColData.sort = 2
Elseif mDay <= abs(DateDiff("d",Now(),Dateadd("m",-1,Now()))) then
scriptColData.value = mDay & Script.config.Item_DayText
scriptColData.sort = 3
ElseIf mDay > abs(DateDiff("d",now(),Dateadd("m",-1,now()))) and mDay < abs(DateDiff("d",now(),Dateadd("yyyy",-1,now()))) Then
scriptColData.value = mMonth & Script.config.Item_MonthText
scriptColData.sort = 4
ElseIf mDay >= abs(DateDiff("d",now(),Dateadd("yyyy",-1,now()))) Then
scriptColData.value = mYear & Script.config.Item_YearText
scriptColData.sort = 5
End If
End Function[/code]

Call Script.RefreshColumn()

leo,But, did not achieve the effect I need,I think in the school-based design of frame inside the modified set list window's title bar changes

Function OnScriptConfigChange(configChangeData) 'how to Refresh Columns Header Call Script.RefreshColumn("Created") Call Script.RefreshColumn("Modified") End Function

Does RefreshColumn() refresh the column header as well? That's new to me, but is required quite often.
I created a column-context menu entry "Re-Add Column" especially to refresh a script columns header.

Probably only the data in the column, not the heading.

If the heading is changing, it sounds like you are replacing one column with a new column, not trying to refresh the existing column.

Not necessarily, the header of an existing column changes as well, especially when creating a new set of columns, for which you do not know exactly how all the columns will be named in the end. It's less, once the script is done of course, but while you're at it, finding and testing out various naming schemes, it does change. And that's where I make use of that "ReAdd Column" thing, it still is inconvenient, especially when you need to do it on multiple columns, that's why I hoped I could use RefreshColumns() here.

The headings for an existing column should not normally change in response to a user's configuration change, though. (Although you can always restart Opus or maybe remove and re-add the column if you really need to change them.)

This should also consider the multi language environment

If you change languages, Opus restarts, so that should not be an issue.

脚本自定义的栏标题是没办法改变的,我的想法是在脚本的设置也里面能够修改栏标题。

Custom script is no way to change the column headings , and my idea is to set up a script which is also able to modify the column headings.

Why does the script need to modify the headings on the fly?

That will just confuse the user in most cases. They add columns with a heading and do not expect the heading to change to something else.

The name and label are part of the definition of the column and should not keep changing, unless you are doing something unusual. If you are doing something unusual then explaining what it is will help us understand.

[quote="leo"]Why does the script need to modify the headings on the fly?

That will just confuse the user in most cases. They add columns with a heading and do not expect the heading to change to something else.

The name and label are part of the definition of the column and should not keep changing, unless you are doing something unusual. If you are doing something unusual then explaining what it is will help us understand.[/quote]

I used the script defines a column , Chinese title "修改于" , but share it with other users when you need to consider the other's language environment in an English environment heading of the column you can change the settings in the script . "modify at ".So that others can not modify the code so that the script can adapt and multilingual environment .

The script can be written for multiple languages and use the language Opus is set to use to decide which headings to use.

Or the user can edit the script code, which will cause the script to be reloaded.

I still do not see a situation where the column headings will change in reaction to a script configuration change. Using script config windows to let the user change heading names for their language would not work well because the config window itself would still be in the wrong language.

Either the script should choose which strings to use for headings based on the language Opus reports it is running under, or the user should edit the script to change the headings. Neither involves OnScriptConfigChange.