B4A Library MLhelp help reader

This is a native library that allows you to display HTML help files from inside your app. The files can contains images, or other features supported in html pages. I'm sure it will need some tweeking for some, but it works for me. Let me know what you think.

Version 1.01 Added 2 new methods


MLHelp
Author:
Jem Miller
Version: 1.01
  • MLHelp
    Events:
    • OverrideUrl (Url As String))
    • PageFinished (Url As String)
    • UserAndPasswordRequired (Host As String, Realm As String))
    Methods:
    • Back
      Back one page
    • Forward
      Forward one page
    • Hide
      Hides the help panel (sends it to back) and sets it to visible = false;
    • Initialize (Parent As ActivityWrapper, Top As Int, Left As Int, Width As Int, Height As Int, Color As Int, Event As String)
      Initializes all variables and creates the view
      Parent - The parent activity (pass Activity)
      Top - Top of the help panel
      Left - Left edge of help panel
      Width - Width of help panel
      Height - Height of help panel
      Color - background color of the title
      Event - Event name used for the WebView. These are OverrideURL, PageFinished and UserAndPasswordRequired. They are the same as for a WebView.
    • LoadPage (FileName As String)
      Loads an HTML help file
      FileName - The HTML file name to load and display
      <code>LoadPage("help.htm")</code>
      The help files and all images they may need to display MUST be named in all LOWERCASE and MUST be in your projects files/www directory (you will need to create the www directory)
    • LoadWebPage (URL As String)
      Loads an HTML page from the internet
      URL - The web address and page to load :
      <code>Dim help As MLHelp
      help.Initialize(Activity,0,0,100%x,100%y,Colors.Yellow,"help")
      help.LoadWebPage("http://www.mlsoft.org/me.jpg")</code>
    • Show
      Shows the help panel if it has already been initialized
    • isInitialized As Boolean
      Returns true if the help panel is initialized and ready to use.
    • isShowing As Boolean
      Returns true if the help panel is showing
    • setColor
      Sets the help panel background color
    Properties:
    • Height As Int
      Sets or gets the Height of the help panel
    • Left As Int
      Sets or gets the Left position of the help panel
    • Title As String
      Sets the title of the help panel
    • TitleColor As Int [write only]
      Sets the color of the title
    • TitleHeight As Int
      Sets or gets the current title bar height
    • TitleSize As Int [write only]
      Sets the title font size
    • TitleTextColor As Int [write only]
      Sets the color of the title text
    • Top As Int
      Sets the or gets top position of the help panel
    • Width As Int
      Sets or gets the Width of the help panel

There is a small sample app included in the zip file.

Version 1.00 - Initial release.

Version 1.01 - Fixed the spelling on TitleSize, and added isInitialized and LoadWebPage methods. You can now load remote web pages, but be aware that the same PageFinished event is used for both local and remote pages. Also modified the mlhelptest project slightly.

-
 

Attachments

  • MLhelp-1.01.zip
    10 KB · Views: 202
Last edited:

johndb

Active Member
Licensed User
Longtime User
Works well. In the next version it may be worth correcting the spelling mistake TtileSize As Int [write only] to TitleSize ;)
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Works well. In the next version it may be worth correcting the spelling mistake TtileSize As Int [write only] to TitleSize

Oops.. Yeah I'll do that in the next update. :)

--- Jem
 

johndb

Active Member
Licensed User
Longtime User
Would it also be possible to allow the loading of a web page in addition to the asset html help? I have asset help pages in html but I also have a forum which is accessible by web. It would be terrific is I could use MLHelp for both .... say loadwwpage? :)
 

HotShoe

Well-Known Member
Licensed User
Longtime User
John, the spelling is fixed, and I added LoadWebPage, and also an isInitialized method. Be aware that LoadPage and LoadWebPage both use the same events for PageFinished, etc. I also exposed the WebView events.

Thanks,

--- Jem
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Checked out your Help. Pretty cool

Is it possible to have a Border around the window instead of the help bars Top and bottom.

Instead of have the thick bar at the bottom would be nice to have a yellow (or whatever color) border around the whole screen

Also: just noticed - is there any way to have a Back button to go back to the previous page. I am using hyperlinks to let the user jump from page to page.

I see we have a back routine but no button.

Thanks

BobVal
 
Last edited:

johndb

Active Member
Licensed User
Longtime User
Checked out your Help. Pretty cool

Is it possible to have a Border around the window instead of the help bars Top and bottom.

Instead of have the thick bar at the bottom would be nice to have a yellow (or whatever color) border around the whole screen

Also: just noticed - is there any way to have a Back button to go back to the previous page. I am using hyperlinks to let the user jump from page to page.

I see we have a back routine but no button.

Thanks

BobVal
I am using MLHelp in one of my applications (under development :)) and have added my own back/home/forward buttons. See below image. I prefer my own buttons as then I have full control.

upload_2015-12-14_12-46-59.png
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Great, now the worst part of being a programmer having to write a help system
:)

Cannot wait to see how you added the buttons to his screen. Any chance of adding a full border around the screen?
 

johndb

Active Member
Licensed User
Longtime User
Great, now the worst part of being a programmer having to write a help system
:)

Cannot wait to see how you added the buttons to his screen. Any chance of adding a full border around the screen?
It would be quite simple. The way I did it is by adding MLHelp to an activity with panels and buttons. A border would be easy to add as well. ;)
 

johndb

Active Member
Licensed User
Longtime User
Sure, I'll post my code later today when I get home.

Activity code: activityHELP
I'm using FontAwesome for defining the button images. https://www.b4x.com/android/forum/threads/fontawesome.53990/
B4X:
#Region  Activity Attributes
    #FullScreen: true
    #IncludeTitle: True
#End Region

#ExcludeFromLibrary: true

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    'Dim sHelpURL As String

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
  
    Dim help As MLHelp
    Dim Back As Button
    Dim forward As Button
    Dim toc As Button
    Dim fa As FontAwesome
  

End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
  
    Activity.Color = Colors.RGB(38,130,160)
  
    help.Initialize(Activity,0dip,0dip,100%x,100%y-25dip,Colors.Yellow,"HELP")
    help.TitleSize  = 18
    help.Title= "HELP"
    help.TitleHeight = 30dip
    help.TitleColor = Colors.RGB(38,130,160)
    help.TitleTextColor = Colors.White
  
  
    fa.Initialize
  
    Dim textsize As Int = 24
  
    Back.Initialize("Back")
    Back.Typeface = fa.FontAwesomeTypeface
    Back.Text = fa.GetFontAwesomeIconByName( "fa-arrow-left")
    Back.Color=Colors.Transparent
    Back.TextSize=textsize
    Activity.AddView(Back,0, Activity.Height-45dip,Activity.Width/3, 45dip)
  
    toc.Initialize("toc")
    toc.Typeface = fa.FontAwesomeTypeface
    toc.Text = fa.GetFontAwesomeIconByName( "fa-book")
    toc.Color=Colors.Transparent
    toc.TextSize=textsize
    Activity.AddView(toc,Activity.Width/3, Activity.Height-45dip,Activity.Width/3, 45dip)
  
    forward.Initialize("forward")
    forward.Typeface = fa.FontAwesomeTypeface
    forward.Text = fa.GetFontAwesomeIconByName( "fa-arrow-right")
    forward.Color=Colors.Transparent
    forward.TextSize=textsize
    Activity.AddView(forward,(Activity.Width/3)*2, Activity.Height-45dip,Activity.Width/3, 45dip)
  
    If cmHELP.ms_HelpURL = "" Then
        help.LoadPage("index.html")
    Else
        help.LoadPage(cmHELP.ms_HelpURL)
    End If

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub back_click()

    help.Back

End Sub

Sub forward_click()

    help.Forward

End Sub

Sub toc_click()

    help.LoadPage("index.html")

End Sub
Code module: cmHELP used to call the help activity
B4X:
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
  
    Dim ms_HelpURL As String

End Sub

Sub ShowHelp (HelpURL As String)
  
    ms_HelpURL = HelpURL
    StartActivity("activityHELP")
  
End Sub

It is quick and dirty code but does the trick for me.

Cheers,

John
 
Top