displaying help
#1
Thge job's not over till the documentation is done. It is quite wrong to think that your program is so self-evident that you don't need to explain to the user what it does.

One way is to write a HTML file and just use the LAUNCH command to open it in the user's default browser. But that requires that you know exactly where the user installed your app. With package management that is limited to two possibilities (boot/system and boot/home/config) but what if the user ripped your hpkg apart with Expander? Or if you don't like packaging and want your app to work in the non-packaged hierarchy? There just is something to be said for an app that is self-contained, with everything it needs in one binary. It just is the BeOS/Haiku way of doing things.

The following routine uses DATA statements to create a HTML file on the fly in the standard Haiku TEMP directory, and then displays it.

Code:
sub ShowHelp()
    local TempfilePath$, File2Write$, Helpline$
    TempfilePath$ = system$("finddir B_COMMON_TEMP_DIRECTORY")
    TempfilePath$ = left$(TempfilePath$, len(TempfilePath$)-1) //strip off trailing newline
    File2Write$ = TempfilePath$ + "/" + "MenuBarHelp.html"    
    restore helpdata
        Open File2Write$ for writing as #9
        while(Helpline$ <> "end_of_data")
        read Helpline$
        if Helpline$ <> "end_of_data" print #9 Helpline$
        wend
    close #9
    launch File2Write$
end sub

label helpdata

data "<!doctype html public \"-//W3C//DTD HTML 4.0 Transitional //EN\">"
data "<html>"
data "<head>"
data "  <meta name=\"GENERATOR\" content=\"mkd2html 2.1.2 DL=DISCOUNT\">"
data "  <meta http-equiv=\"Content-Type\""
data "        content=\"text/html; charset-us-ascii\">  <title>MenuBar Help</title>"
data "</head>"
data "<body>"
data "<h1>MenuBar</h1>"
data "<h2>A Desktop Accessory for Haiku</h2>"
data "<p>Version 0.1</p>"
data "<p>I enjoy accessing my applications from a hierarchical menu. I also enjoy writing applications with very minimal interfaces. These two preferences come together in MenuBar.</p>"
data "<p>Back in the BeOS days (and in Haiku before Package Management), we could mess around in the Deskbar to our heart&rsquo;s content, setting up subdirectories to reflect the way we wanted to categorize our apps.</p>"
data "<p>No longer. Shortcuts to apps are now kept in three separate locations, and two of them are not editable by the user. The deskbar&rsquo;s single Applications menu quickly becomes an endlessly scrolling list of apps. This is where MenuBar comes in.</p>"

//More lines of DATA statements deleted from this example

data "</body></html>"
data "end_of_data"

One thing to note: wherever there is a " or a / in your DATA statements you need to escape it with another backslash: /" and //. This enables you to PRINT the results to the HTML file.

[/code]
Reply
#2
(07-15-2015, 11:20 AM)clasqm Wrote: Thge job's not over till the documentation is done. It is quite wrong to think that your program is so self-evident that you don't need to explain to the user what it does.

One way is to write a HTML file and just use the LAUNCH command to open it in the user's default browser. But that requires that you know exactly where the user installed your app. With package management that is limited to two possibilities (boot/system and boot/home/config) but what if the user ripped your hpkg apart with Expander? Or if you don't like packaging and want your app to work in the non-packaged hierarchy? There just is something to be said for an app that is self-contained, with everything it needs in one binary. It just is the BeOS/Haiku way of doing things.

The following routine uses DATA statements to create a HTML file on the fly in the standard Haiku TEMP directory, and then displays it.

Code:
sub ShowHelp()
    local TempfilePath$, File2Write$, Helpline$
    TempfilePath$ = system$("finddir B_COMMON_TEMP_DIRECTORY")
    TempfilePath$ = left$(TempfilePath$, len(TempfilePath$)-1) //strip off trailing newline
    File2Write$ = TempfilePath$ + "/" + "MenuBarHelp.html"    
    restore helpdata
        Open File2Write$ for writing as #9
        while(Helpline$ <> "end_of_data")
        read Helpline$
        if Helpline$ <> "end_of_data" print #9 Helpline$
        wend
    close #9
    launch File2Write$
end sub

label helpdata

data "<!doctype html public \"-//W3C//DTD HTML 4.0 Transitional //EN\">"
data "<html>"
data "<head>"
data "  <meta name=\"GENERATOR\" content=\"mkd2html 2.1.2 DL=DISCOUNT\">"
data "  <meta http-equiv=\"Content-Type\""
data "        content=\"text/html; charset-us-ascii\">  <title>MenuBar Help</title>"
data "</head>"
data "<body>"
data "<h1>MenuBar</h1>"
data "<h2>A Desktop Accessory for Haiku</h2>"
data "<p>Version 0.1</p>"
data "<p>I enjoy accessing my applications from a hierarchical menu. I also enjoy writing applications with very minimal interfaces. These two preferences come together in MenuBar.</p>"
data "<p>Back in the BeOS days (and in Haiku before Package Management), we could mess around in the Deskbar to our heart&rsquo;s content, setting up subdirectories to reflect the way we wanted to categorize our apps.</p>"
data "<p>No longer. Shortcuts to apps are now kept in three separate locations, and two of them are not editable by the user. The deskbar&rsquo;s single Applications menu quickly becomes an endlessly scrolling list of apps. This is where MenuBar comes in.</p>"

//More lines of DATA statements deleted from this example

data "</body></html>"
data "end_of_data"

One thing to note: wherever there is a " or a / in your DATA statements you need to escape it with another backslash: /" and //. This enables you to PRINT the results to the HTML file.

[/code]

If users have made a tutorial for here programs, they are welcome to give them to our knowledge base. Then you can link from your app to our website.

I have all my documentations of my programs placed on our knowledge base and i think this is a good position.

http://www.besly.de
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)
Free Web Hosting