Silverfrost Forums

Welcome to our forums

getting some white space round the text in %ht

10 Feb 2007 1:16 #1643

Does anyone know how to introduce some white space around the text in a hypertext box please? The text completely fills the available space, and a little white outline would make it look much nicer.

I found the instructions in the help file quite confusing, and would have saved much time if it had been clearer that the bit in the [...] of the %ht control was the <DOC NAME= ...> topic, and that there was a subroutine to swap this (CHANGE_HYPERTEXT@) ... the BROWSE demo is in C, which is a foreign language to me. (It isn't difficult once one knows how it works, but if 'DOC NAME=' had been 'TOPIC NAME=' and 'CHANGE_HYPERTEXT@' was 'CHANGE_HYPERTEXT_TOPIC@', then the penny would have dropped sooner).

Is there a way to compute what the 'average width' (and indeed, line height) of a character is in pixels? I presume that the parameters returned from GET_SYSTEM_FONT@ are the correct ones for me to look at - but what exactly are they? The reason I ask is simply to make a %bv box the same height as an adjacent %ht box, as they are specified in different units, and to save myself the trouble of experimenting. An example would be helpful.

Eddie

10 Feb 2007 5:09 #1644

On reflection, and several hours into what is encapsulated in my second paragraph, I realise that I still don't understand how to update the contents of a %ht box other than redrawing the window and thus re-specifying the topic name ... which incidentally has to be stripped of trailing blanks, or CW+ complains of a missing ']'.

CHANGE_HYPERTEXT@ appears not to do anything, and there isn't a variable to use in WINDOW_UPDATE@.

Help would be gratefully accepted.

Eddie

10 Feb 2007 5:09 #1645

I am not sure what you are looking for but &nbsp is a hypertext non-break space.

get_text_size@ gives the width and depth of a character variable but this is in the context of a %gr 'drawing surface'. The associated API function is GetTextExtentPoint32 but this requires a device context.

18 Feb 2007 5:10 #1684

Programming is a deeply frustrating business - when I stripped all the commented-out 'failed tries' and one or two things like IMPLICIT statements that were doing nothing (so I could post not-working code) ... the darn thing worked I have some partial answers: a %bv box 480 pixels high is the same height as a 30 row %ht control, so a line must be 16 pixels. I'll live in hope that this works on all screen resolutions.

However, I do find that hypertext in a %ht box does go right to the edge and it would look so much better if it didn't. A 'no-break-space' doesn't help (and doesn't work in a %ht box).

I'm also finding that the font in an <equation> </equation> tag is huge, so this tag can't be used 'in-line' to give Greek or Maths letters & symbols, nor to fudge superscripts and subscripts. Is there any way of controlling this?

Clearly, a %bv control with a %ht control makes for a very simple 'home grown' help system, but it doesn't look as nice as CHM, no matter how hard one tries.

Eddie

18 Feb 2007 6:19 #1688

You could try using plain text preceded by %fn[symbol] and maybe %ts.

There is also the possibility of using the upper range of ASCII values (>127) with certain fonts.

I would need a simple sample before commenting on the spacing problem.

19 Feb 2007 11:21 #1696

Paul,

Here's my test code. The Hypertext file is needed (too long to post) and the code needs the book1 and book2 icons - although I had to draw 2 more as the ones used in the demo program look too small on my system (the help file says 16x16, although the open and closed book icons in the demo only take up the 16x16 area, they are 32x32 icons!). I drew open and closed books at 32x32 and they work quite nicely.

This whole lot is written in Fortran-77 style except for the multiple statements on one line that I closed up when originally preparing this to post. My list of help topics is very long - 53 items - so I have cut this down, and assumed you could find a 5-item hypertext file to use.

Regards

Eddie

  OPTIONS (INTL)
  WINAPP  300000, 500000, 'SS_icon.RC'
  PROGRAM TEST
  INCLUDE <WINDOWS.INS>
  EXTERNAL NUDGE_TOPIC_FN, HelpNext_FN, HelpPrev_FN
  CHARACTER*(35) TOPIC
  CHARACTER*(35) OPTIONS(60), TOPICNAMES(60)
  COMMON/HYP/IHelpHandle,IOPT,OPTIONS,TOPICNAMES,TOPIC
  COMMON/HELPBUTTON/ NoNext, NoPrev, MAXTOPICS
  CALL PRESET
  CALL ADD_HYPERTEXT_RESOURCE@('SSHelp')
  TOPIC=TOPICNAMES(1);      L=LEN_TRIM(TOPIC)
  NoNext=1;     NoPrev=0;     MAXTOPICS = 5
  IA=WINIO@('%ca[Branch view with Help]%hw&amp;',IHelpHandle)
  IA=WINIO@('%mi[ICON_1]&amp;')
  IA=WINIO@('%sy[3d_thin,thin_border]&amp;')
  IA=WINIO@('%bg[btnface]&amp;')
  IA=WINIO@('%ob&amp;')
  IA=WINIO@('%^`bv[has_lines,has_buttons,paired_bitmaps,
 &amp;   lines_at_root,show_selection_always]&amp;',250,320,
 &amp;   OPTIONS,52,IOPT,'BOOK1,BOOK2',NUDGE_TOPIC_FN)
  IA=WINIO@('%cb&amp;')
  IA=WINIO@('%ob%`bg[white]%ob[invisible]&amp;')
  IA=WINIO@('%`bg[white]%60.20ht['//TOPIC(1:L)//']%cb%cb&amp;')
  IA=WINIO@('%ff%nl%cn%6bt[Close]    &amp;')
  IA=WINIO@('%6~^bt[Previous]    &amp;',NoPrev,HelpPrev_FN)
  IA=WINIO@('%6~^bt[Next]',NoNext,HelpNext_FN)
  END

  INTEGER FUNCTION NUDGE_TOPIC_FN()
  INCLUDE <WINDOWS.INS>
  CHARACTER*(35) OPTIONS(60), TOPICNAMES(60), TOPIC
  COMMON/HYP/IHelpHandle,IOPT,OPTIONS,TOPICNAMES,TOPIC    
  TOPIC = TOPICNAMES (IOPT); L = LEN_TRIM (TOPIC)
  CALL CHANGE_HYPERTEXT@(IHelpHandle,TOPIC(1:L))
  NUDGE_TOPIC_FN = 1
  RETURN
  END     

  SUBROUTINE PRESET
  CHARACTER*(35) OPTIONS(60), TOPICNAMES(60), TOPIC
  COMMON/HYP/IHelpHandle,IOPT,OPTIONS,TOPICNAMES,TOPIC
  OPTIONS( 1)='ACAIntroduction                    '
  OPTIONS( 2)='BCAOptions                         '
  OPTIONS( 3)='ACAColour                          '
  OPTIONS( 4)='BCALines                           '
  OPTIONS( 5)='BCAAreas                           '
  TOPICNAMES( 1)='HELPINTRO                          '
  TOPICNAMES( 2)='OPTIONS                            '
  TOPICNAMES( 3)='COLOUR                             '
  TOPICNAMES( 4)='LINES                              '
  TOPICNAMES( 5)='AREAS                              '

  RETURN
  END

  INTEGER FUNCTION HelpPrev_FN()
  CHARACTER*(35) TOPIC
  CHARACTER*(35) OPTIONS(60), TOPICNAMES(60)
  COMMON/HYP/IHelpHandle,IOPT,OPTIONS,TOPICNAMES,TOPIC
  COMMON/HELPBUTTON/ NoNext, NoPrev, MAXTOPICS
  INCLUDE <WINDOWS.INS>
  IOPT = MAX(1, IOPT-1)
  IF (IOPT .EQ. 1) THEN
     NoPrev = 0
     NoNext = 1
     Else
     NoPrev = 1
     NoNext = 1
     ENDIF
  TOPIC = TOPICNAMES (IOPT); L = LEN_TRIM (TOPIC)
  CALL CHANGE_HYPERTEXT@(IHelpHandle,TOPIC(1:L))
  CALL WINDOW_UPDATE@(IOPT)
  HELPPREV_FN = 1
  RETURN
  END

  INTEGER FUNCTION HelpNext_FN()
  CHARACTER*(35) TOPIC
  CHARACTER*(35) OPTIONS(60), TOPICNAMES(60)
  COMMON/HYP/IHelpHandle,IOPT,OPTIONS,TOPICNAMES,TOPIC
  COMMON/HELPBUTTON/ NoNext, NoPrev, MAXTOPICS
  INCLUDE <WINDOWS.INS>
  IOPT = MIN(MAXTOPICS, IOPT+1)
  IF (IOPT .EQ. MAXTOPICS) THEN
     NoNext = 0
     NoPrev = 1
     Else
     NoNext = 1
     NoPrev = 1
     ENDIF
  TOPIC = TOPICNAMES (IOPT); L = LEN_TRIM (TOPIC)
  CALL CHANGE_HYPERTEXT@(IHelpHandle,TOPIC(1:L))
  CALL WINDOW_UPDATE@(IOPT)
  HELPNext_FN = 1
  RETURN
  END
19 Feb 2007 11:57 #1699

.... and it was too long for the forum. The end of the missing routine is similar to the previous routine.

Eddie

Please login to reply.