guiAddRemoveHelp の作成
S-PLUS for Windows 6.0 日本語版上で、次の関数を定義してください。
(必ず、Windows 版のバージョン 6.0 でなおかつ、日本語版であることを確認してください)
コマンド・ウィンドウ上に次の guiAddRemoveHelp から、最後の } までをコピーペーストして、最後にエンターキーを押してください。作成されますと、
Warning messages:
Conflicting definitions of "guiAddRemoveHelp" on databases ...
という内容のワーニングが出ますが、問題ありません。
############################
guiAddRemoveHelp <-
function(item.name, item.description, item.help.description, item.loc = paste(
getenv("SHOME"), "/module/", item.name, sep = ""), item.index = 1,
item.remove = F)
{
help.file.exists <- F
if(is.ui.app("s+gui") && !missing(item.name) && any(item.name != "") &&
!guiMustQueue(gui.class = "MenuItem")) {
if(missing(item.description))
item.description <- item.name
if(missing(item.help.description))
item.help.description <- item.name
menubar.name <- paste("SPlusMenuBar", "Help", "Avail_Help",
paste(item.name, "_help", sep = ""), sep = "$")
help.path <- paste(switch.path.delims(item.loc, to.backslash
= F), "/", item.name, ".chm", sep = "")
item.location <- locate.menu.item(item.help.description)
help.item.exists <- length(item.location) == 3 &&
item.location[1] == "&Help" && item.location[2] ==
"Available &Help"
help.file.exists <- file.exists(help.path)
if(help.item.exists && (!help.file.exists || item.remove))
guiRemove("MenuItem", Name = menubar.name)
else if(!help.item.exists && help.file.exists && !item.remove
)
guiCreate("MenuItem", Name = menubar.name, Type =
"MenuItem", DocumentType = "Any Documents",
Overwrite = F, Index = locate.menu.item(
"S-PLUSヘルフ゜(&H)", return.numeric = T)[3] +
item.index, StatusBarText = paste(
"Displays the", item.description, "help"),
MenuItemText = item.help.description, Action
= "Expression", Command = paste(
"invisible(callBrowse(\"", help.path,
"\",option=4))", sep = ""))
}
invisible(help.file.exists)
}
############################
文中の「ヘルプ」は半角カナ文字です(S-PLUS のデータセットとして、半角カナ文字を使うことができません。ご注意ください)。
また、どうしてもこの関数定義がうまく行かない、という方はsplus-support@ml.msi.co.jp まで、表題を「ヘルプ追加の件」として、お知らせください