Mr. Linares -> Error Message on .CHM-Help

Mr. Linares -> Error Message on .CHM-Help

Postby byte-one » Thu Aug 28, 2008 2:32 pm

I am just updated to 8.08. When I use the CHM-Help-Feature there are an error-message on folder dialogs, when I press F1. (Argument error: == )
No help-IDs are defined.

This could be the required changes:

    function chmHelpTopic( cnTopic )

    local cHelpFile := GetHelpFile()
    local cHelpTopic := GetHelpTopic()
    local nCmd := 0

    if Empty( cHelpFile )
    MsgStop( "No Help file available", " Attention" )
    return .F.
    endif

    if PCount() == 0
    // display contents with default topic
    nCmd := HH_DISPLAY_TOC
    cnTopic := nil
    else
    do case

    case cnTopic == "N" // help id of topic
    should be ->>> case valtype(cnTopic) == "N"



    nCmd := HH_HELP_CONTEXT

    case cnTopic == "C" // help topic name
    should be ->>> case valtype(cnTopic) == "C"


    nCmd := HH_DISPLAY_TOPIC
    cnTopic := ExtHtm( cnTopic )



Another problems:
1.) If I define a Help-ID for a dialog, the help-item with this ID are not shown with F1, always the index. In tests the ::nHelpId from this dialog in Windows-class are empty instead the defined help-id!
2.) When I call the help on an dialog with help-ID and with a folder in this dialog then first shown for a short time the right help-ID and then also the helpindex.
3.) Another point of interest are help-IDs for the folder-dialogs! (oFld:aDialogs[1...,2...,]:nHelpId := 22) and the help-ID from the parent dialog from folder.

Please check this.
Last edited by byte-one on Sat Aug 30, 2008 10:45 am, edited 2 times in total.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby byte-one » Sat Aug 30, 2008 10:40 am

Mr. Linares, is there any suggestion for this problem?
Functioning CHM-Help is a MUST for an professional programm.

I will test all functions and make changes for our FWH if required.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby Antonio Linares » Sat Aug 30, 2008 6:36 pm

Günther,

Yes, you are right, many thanks for your feedback :-)

This is the right code as you have commented:
Code: Select all  Expand view  RUN
      do case
         case ValType( cnTopic ) == "N"
              // help id of topic
              nCmd = HH_HELP_CONTEXT
             
         case ValType( cnTopic ) == "C"
              // help topic name
              nCmd     = HH_DISPLAY_TOPIC
              cnTopic  = ExtHtm( cnTopic )   // Add .htm extn.
                                             // Prg can use either .hlp or .chm
         ...

We are also reviewing your other commented issues, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Aug 30, 2008 7:40 pm

Günther,

>
1.) If I define a Help-ID for a dialog, the help-item with this ID are not shown with F1, always the index. In tests the ::nHelpId from this dialog in Windows-class are empty instead the defined help-id!
>

This example is working fine here:

test.prg
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   local oDlg, oFld
   
   SET HELPFILE TO "fwclass.chm"
   
   DEFINE DIALOG oDlg SIZE 400, 300 HELPID "classes_hierarchy"

   @ 0.5, 1 FOLDER oFld OF oDlg SIZE 188, 138 ;
      PROMPTS "One", "Two", "Three"
     
   ACTIVATE DIALOG oDlg CENTERED

return nil

Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sat Aug 30, 2008 7:46 pm

>
2.) When I call the help on an dialog with help-ID and with a folder in this dialog then first shown for a short time the right help-ID and then also the helpindex.
>

This is not observed in our previous example.

Could you please modify our example to show it ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby byte-one » Sun Aug 31, 2008 8:38 pm

Antonio, I define the dialog not in function main()! I define the dialog with nHelpId from a main-window with menu! It seems, all both (dialog and then main-window) ::help()-functions are calling!?
Can you show me the logic of the help-call from CONTROL (popup-help) to DIALOG to WINDOW?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby Antonio Linares » Sun Aug 31, 2008 10:41 pm

Günther,

> I define the dialog with nHelpId from a main-window with menu!

Please provide a small and self contained example to reproduce it, thanks

I don't fully understand what you are doing.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby byte-one » Mon Sep 01, 2008 9:24 am

Antonio, I have send to you an EXE and CHM what show you the problem to call an helpID from dialog.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby Antonio Linares » Mon Sep 01, 2008 12:16 pm

Günther,

It seems as your CHM does not have a topic 11. Please try this test. Here it is working fine and it shows "Installation" topic when F1 is pressed on the dialog. Please notice that the REDEFINE GET is commented.

test.prg
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   local oWnd, oMenu

   SET HELPFILE TO "skydrive.chm"

   MENU oMenu 2007
      MENUITEM "Test" ACTION Test()
   ENDMENU

   DEFINE WINDOW oWnd MENU oMenu

   ACTIVATE WINDOW oWnd
   
return NIL

function Test()

   local oDlg, cTest := "Hello   "
   
   DEFINE DIALOG oDlg RESOURCE "test" HELPID "Installation"

   // REDEFINE GET cTest ID 106 OF oDlg

   ACTIVATE DIALOG oDlg CENTERED
   
return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Sep 01, 2008 12:19 pm

Now, if we use the REDEFINE GET there is a bug in FWH, as the HelpTopic() of the GET is invoked, but the GET does not have a helpid, so the help index is shown!

This is the required fix for Class TDialog, so a control with no defined helpid will not be used to show help:
Code: Select all  Expand view  RUN
METHOD Help( nWParam, nLParam ) CLASS TDialog

   local hWndChild := HelpCtrlHwnd( nLParam ), nAtChild

   static lShow := .f.

   ::lHelpIcon = .f.

   if ! lShow
      lShow = .t.
      if ( nAtChild := AScan( ::aControls, { | o | o:hWnd == hWndChild } ) ) != 0 .and. ;
         ! Empty( ::aControls[ nAtChild ]:nHelpID )
         ::aControls[ nAtChild ]:HelpTopic()
      else
         ::HelpTopic()
      endif
      lShow = .f.
   endif   

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Mon Sep 01, 2008 12:21 pm

Günther,

With the previous fix applied to Class TDialog, please uncomment the REDEFINE GET in my example and test it, you will see that the "Installation" topic (that belongs to the dialog) is invoked.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby byte-one » Tue Sep 02, 2008 10:53 am

Antonio, I have send to you another executable that shows the problem and modified dialog.prg and window.prg.
I also not understand the static variable lShow in the methods for help.
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Postby Antonio Linares » Tue Sep 02, 2008 11:22 am

Günter,

You forgot to send me the source code for TestHelp.prg. Please send it to me.

> I also not understand the static variable lShow in the methods for help

To avoid recursive calls
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Tue Sep 02, 2008 11:25 am

Also, to manage CHMs you have to use strings for topics IDs, not numbers (unless you specify a DLL to search for strings based on IDs, which will make things more complex).

What tool are you using to build your CHM files ? We do recommend Help&Manual
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby byte-one » Tue Sep 02, 2008 12:11 pm

As I use numbers or strings for helpid, the right CHM topic not is shown! I have send to you the files.

> I also not understand the static variable lShow in the methods for help
> To avoid recursive calls

But the lShow always on beginn of help-method is set to .f. !?

method help()
static lShow := .f.

if ! lshow
lshow := .t.
..
..
lshow := .f.
endif

This construct is for me not clear and in this form this cannot avoid recursions? Should lShow not be a CLASSDATA or so?
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 39 guests

cron