question to "static far char cHelpTopic[ 50 ];"

question to "static far char cHelpTopic[ 50 ];"

Postby byte-one » Mon Sep 08, 2008 10:22 am

Hello Antonio, you know that i do a check of the CHM help system. I will programm the new functions SetHelpPopup() and GetHelpPopup(). Can I do this instruction in helpchm.prg from FWH and is this variable then visible in all the user-*.prg?

static far char cHelpPopup[ 30 ]; //similar to "static far char cHelpTopic[ 30 ];" in help.c
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 08, 2008 10:44 am

Günther,

"far" is no longer needed in 32 bits, so you can define it like this:

static char cHelpPopup[ 30 ];

What do you want to do ? May I help you ?
regards, saludos

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

Postby byte-one » Mon Sep 08, 2008 1:08 pm

Antonio, I will define the name of the embedded txt-file in a CHM file for popup help topics. I read the way (static far cHelpFile [50] ) in your help.c source file. My question is, when i define a "static (far not needed as you write above) char cHelpPopup[ 30 ]" in FWH helpchm.prg, this pointer is visible from every prg-file from the programmer, or must this declared in FWH help.c?

Also should the popuphelp only callable with the mouse on "?" from the dialog systemcaption. F1 should always show the normal help from dialog. Can me show the way to this?

Please show also to:
http://forums.fivetechsoft.com/viewtopi ... 3441#63441

I will provide all source when the problems changed to not problems! :lol:
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 » Tue Sep 09, 2008 9:01 am

Antonio, any suggestion?
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 09, 2008 9:13 am

Günther,

If you declare a static C variable then you need to implement a function to Get or Set its contents:
Code: Select all  Expand view

static char cHelpPopup[ 30 ];

HB_FUNC( SETGETHELPPOPUP )
{
   if( hb_pcount() > 0 )
      strcpy( cHelpPopup, hb_parc( 1 ) );
   
   hb_retc( cHelpPopup );
}
regards, saludos

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

Postby Antonio Linares » Tue Sep 09, 2008 9:16 am

Also you have to properly initialize the static variable, as the C compiler doesn't do it for you, so it will contain rubish:

cHelpPopup[ 0 ] = 0;
regards, saludos

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

Postby Enrico Maria Giordano » Tue Sep 09, 2008 9:31 am

Antonio Linares wrote:Also you have to properly initialize the static variable, as the C compiler doesn't do it for you, so it will contain rubish:


No, in C language variables with static lifetime are automatically initialized to zero.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Tue Sep 09, 2008 9:56 am

Enrico,

Yes, you are right, thanks :-)
regards, saludos

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

Postby Antonio Linares » Tue Sep 09, 2008 9:58 am

Günther,

Here you have an example that will provide you a good understanding about how the help works in Windows, so you can decide how to implement it.

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

#define WM_HELP        0x0053
#define WM_SYSCOMMAND  0x0112
#define WM_LBUTTONDOWN 0x0201

#define SC_CONTEXTHELP 0xF180

function Main()

   local oDlg := TMyDialog():New()

   oDlg:Activate()

return nil

CLASS TMyDialog FROM TDialog

   METHOD HelpF1() VIRTUAL
   
   METHOD Help( nWParam, nLParam ) VIRTUAL
   
   METHOD HandleEvent( nMsg, nWParam, nLParam )

ENDCLASS

METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TMyDialog

   static lContextHelp := .F.

   if nMsg == WM_HELP
      MsgInfo( "HandleEvent WM_HELP" )
   endif   
   
   if nMsg == WM_SYSCOMMAND .and. nWParam == SC_CONTEXTHELP   
      MsgInfo( "HandleEvent WM_SYSCOMMAND SC_CONTEXTHELP" )
      lContextHelp = .T.
   endif   
   
   if nMsg == WM_LBUTTONDOWN .and. lContextHelp
      MsgInfo( "HandleEvent WM_LBUTTONDOWN .and. lContextHelp" )
      lContextHelp = .F.
   endif   

return Super:HandleEvent( nMsg, nWParam, nLParam )
regards, saludos

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

Postby byte-one » Tue Sep 09, 2008 10:23 am

Thanks you very much! I will implement it.
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 » Wed Sep 10, 2008 3:36 pm

Antonio, yesterday i have send to you an email with all required changes for better CHM help. You can add this in a new build from FWH.
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 » Wed Sep 10, 2008 4:01 pm

Günther,

We are going to review it asap, thanks! :-)
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 75 guests