|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Sat Feb 10, 2007 2:16 pm Post subject: getting some white space round the text in %ht |
|
|
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 |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Sat Feb 10, 2007 6:09 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Sat Feb 10, 2007 6:09 pm Post subject: |
|
|
I am not sure what you are looking for but   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. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Sun Feb 18, 2007 6:10 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Sun Feb 18, 2007 7:19 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Mon Feb 19, 2007 12:21 pm Post subject: |
|
|
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&',IHelpHandle)
IA=WINIO@('%mi[ICON_1]&')
IA=WINIO@('%sy[3d_thin,thin_border]&')
IA=WINIO@('%bg[btnface]&')
IA=WINIO@('%ob&')
IA=WINIO@('%^`bv[has_lines,has_buttons,paired_bitmaps,
& lines_at_root,show_selection_always]&',250,320,
& OPTIONS,52,IOPT,'BOOK1,BOOK2',NUDGE_TOPIC_FN)
IA=WINIO@('%cb&')
IA=WINIO@('%ob%`bg[white]%ob[invisible]&')
IA=WINIO@('%`bg[white]%60.20ht['//TOPIC(1:L)//']%cb%cb&')
IA=WINIO@('%ff%nl%cn%6bt[Close] &')
IA=WINIO@('%6~^bt[Previous] &',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
|
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2391 Location: Yateley, Hants, UK
|
Posted: Mon Feb 19, 2007 12:57 pm Post subject: |
|
|
.... and it was too long for the forum. The end of the missing routine is similar to the previous routine.
Eddie |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|