Entry
TSE: Menu: Character: Hotkey: Get: All: How to get all the hotkey characters in a menu block?
Nov 7th, 2006 12:57
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden --- 07 November 2020 - 08:51 pm -------------------
TSE: Menu: Character: Hotkey: Get: All: How to get all the hotkey
characters in a menu block?
---
You search for all the menu lines in the given block, and extract the
first character after the '&' in each of that menu lines, and
concatenate this to a string.
===
Menu lines are currently assumed to start in the begin of the line with
a double quote, then some text, and finish with a double quote.
This must be followed by a comma.
===
Steps: Overview:
1. -First you mark a block also containing your menu lines.
2. -Run the macro
3. -It will then go through the first to last (menu) line of that
block.
4. -In each line it will check if it finds the "&" and then extract 1
character after the "&" and put this in a string.
5. -When finished it will thus return a string with all hotkey
menu characters in that block
===
--- cut here: begin --------------------------------------------------
// library: string: get: menu: block: character: hotkey: all
(filenamemacro=getsthal.s) [kn, ho, tu, 07-11-2020 20:44:45]
STRING PROC FNStringGetMenuBlockCharacterHotkeyAllS()
INTEGER downB = TRUE
STRING s[255] = ""
STRING menuLetterAllS[255] = ""
STRING menuLetterS[255] = ""
INTEGER foundI = 0
IF NOT IsBlockMarked()
Warn( "please mark a block" )
RETURN( "" )
ENDIF
PushPosition()
GotoBlockBegin()
WHILE IsCursorInBlock() AND downB
IF LFind( '^{[ ]@}{["].*["]}', "x" )
s = GetFoundText( 2 )
foundI = Pos( "&", s )
IF ( foundI <> 0 )
menuLetterS = SubStr( s, foundI + 1, 1 )
menuLetterAllS = menuLetterAllS + menuLetterS
ENDIF
ENDIF
downB = Down()
ENDWHILE
PopPosition()
RETURN( menuLetterAllS )
END
PROC Main()
Message( FNStringGetMenuBlockCharacterHotkeyAllS() ) // gives
e.g. "ABCDFGH"
END
<F12> Main()
--- cut here: end ----------------------------------------------------
===
Internet: see also:
---
TSE: Menu: Character: Hotkey: Link: Overview: Can you give an overview
of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/42905/fid/1571
----------------------------------------------------------------------