Thanks Fernando,
just to add for other, you have to add to your imports
import webbrowser
you'll have to define self.macroFileFolder in def __init__
class SCR_ABReportElevationDifference(StackPanel): # this inherits from the WPF StackPanel control
def __init__(self, currentProject, macroFileFolder):
with StreamReader (macroFileFolder + r"\SCR_ABReportElevationDifference.xaml") as s:
wpf.LoadComponent (self, s)
self.currentProject = currentProject
self.macroFileFolder = macroFileFolder
and in "def Onload" I added
buttons[2].Content = "Help"
buttons[2].Visibility = Visibility.Visible
buttons[2].Click += self.HelpClicked
the button-click is then handled as follows
def HelpClicked(self, cmd, e):
webbrowser.open('file://' + os.path.realpath(self.macroFileFolder + "\\" + type(self).__name__+".htm"))
That way I can just copy and paste it to all macros and name the help HTML file the same as the macro.
type(self).__name__
retrives the macro name from the class definition
class SCR_ABReportElevationDifference(StackPanel): # this inherits from the WPF StackPanel control
Keeps it uniform. I've got all my macros grouped in subfolders, which correspond to the menu tabs and groups on the tab.
------------------------------
Ronny Schneider
------------------------------
Original Message:
Sent: 10-26-2021 02:26
From: Fernando Calvo
Subject: what program do you use to create help files (.CHM)?
Hi,
another option is to add a "?" help button to your form and open it from there i.e. with the following code which works both for .html´s and .pdf´s:
webbrowser.open('file://' + os.path.realpath(self.macroFileFolder + "\\report.html"))
webbrowser.open('file://' + os.path.realpath(self.macroFileFolder + "\\Test.pdf"))
I think I`ll add both options to my macros as some customers don´t have internet access the whole time.
Regards,
Fernando
------------------------------
Fernando Calvo
calvo@calvo-geospatial.com
Original Message:
Sent: 10-25-2021 23:07
From: Ronny Schneider
Subject: what program do you use to create help files (.CHM)?
Thanks guys.
In the meanwhile I think the easiest way to create a simple HTML page the WYSIWYG way is to use MS Word.
In worst case I can still compile them with the MS HTML Help Workshop to .CHM. I found a link in an archive in a forum.
But a single HTML page in each macro folder would be better. But setting cmdData.HelpFile with https:// seems to require an actual webserver, can't point to a local file.
Using "file://" doesn't open the HTML or i.e. a PDF.
------------------------------
Ronny Schneider
Original Message:
Sent: 10-25-2021 16:56
From: Quan Mueller
Subject: what program do you use to create help files (.CHM)?
As Fernando posted, I would recommend creating HTML file/s alongside your TML files.
In your TML's Setup() method, you can specify the path to your help file in CmdData.HelpFile="your file path here"
If it starts with "https:" it will launch the default browser.
I think support for a local HTML was added too - perhaps that's what Fernando was mentioning. I haven't played with that specifically - so don't know if just a relative path to an HTML file, or whether it uses the "file://" prefix to specify an exact path (not relative).
Using HTML has the advantage that if you later need to post your help online (like posting in the forums for example), hopefully you can copy/paste portions of it out.
I had expected for TMLs to just link to forum posts or online webpages - but it's true there are disadvantages: no offline access, access uses bandwidth, the single Help page may conflict w/ the version installed, etc.
------------------------------
Quan Mueller
Revenant Solutions - TML Development
Original Message:
Sent: 10-24-2021 23:36
From: Ronny Schneider
Subject: what program do you use to create help files (.CHM)?
.CHM seems to be a rather old/outdated format and the downloads for Microsofts HTML Help Workshop seem to be broken and refer in circles.
Any tip on a lightweight/freeware program to create decent looking help files for my macros.
------------------------------
Ronny Schneider
------------------------------