Loading ...
Sorry, an error occurred while loading the content.

19010Re: Navigate Outline Clip

Expand Messages
  • vanwasdi
    Mar 11 9:38 AM
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
      >
      > --- In ntb-clips@yahoogroups.com, "vanwasdi" <dirk.vanwassenhove@> wrote:
      > >
      > > This working clip popups a wizard to navigate an outline. I have some questions to refine it.
      > >
      > > CLIP
      > > -------------------------------------------------
      > > H="Navigate Outline"
      > > ;check if outline if not end
      > > ^!If ^$IsOutlineDoc$ = 1 Skip_2 ELSE Next
      > > ^!Info No outline! Clip stops.
      > > ^!Goto End
      > >
      > > ;clear variables en save document
      > > ^!ClearVariables
      > > ^!Save
      > >
      > > ;set focus to headings window and copy headings to clipboard
      > > ^!SetFocus OutLine
      > > ^!Keyboard Shift+F10 T
      > >
      > > ;sort headings
      > > ^!Set %Headings%=^$StrSort("^$GetClipboard$";False;True;False)$
      > >
      > > ;replace hard returns with | to prepare the content of the wizard
      > > ^!Set %Headings%=^$StrReplace("^p";"|";"^%Headings%";True;False)$
      > >
      > > ;wizard
      > > ^!Set %ChoosenHeading%=^?{(T=L;H=100)Type Choose a value=^%Headings%}
      > >
      > > ;goto choosen headng
      > > ^!TopicShow "^%ChoosenHeading%"
      > > ^!FocusDoc
      > > -------------------------------------------------
      > >
      > > QUESTIONS
      > >
      > > 1. As you can see the height of the wizard is set to 100 (H=100) but Notetab restricts that height to 35 or so. Is there a solution to that problem?
      >
      > I think you discovered a bug. If you use a setting greater than 34, it creates a second vertical scrollbar. Solution, do not use a setting greater than 34.
      >
      > > 2. When you have document with to much heading to fit in the wizard, you can not reach the last headings without using the mouse. When you chose the END key the last item is selected, but you can not see it. Any ideas?
      >
      > Using H=34 or less solves the problem. Otherwise you need to scroll the extra scrollbar to see the bottom.
      >
      > > 3.Can I set the width of the wizard?
      >
      > ^!SetWizardWidth npercent is available since version 5.7. For example ^!SetWizardWidth 200 sets wizards to be be twice as wide as normal.
      > >
      >
      > Here are a few other suggestions:
      >
      > 1. Do not use ^!ClearVariables. Clear only the variables used by your clip, so variables you may want to preserve (that exist in other clips) are not affected. Clear your individual variables at the end of the clip.
      >
      > 2. Don't use ^!Keyboard in your process to get the outline headers, not necessary and not reliable. You can use a loop with ^$GetTopicHeading(index)$. Where you do use ^!Keyboard, you need ample delays around it, to make sure the keystrokes hit the right window. When I first tried your clip, other existing clipboard text ended up in my wizard.
      >
      > 3. Don't use the clipboard, use a variable (which you clear at the end). Why bother the clipboard unless you need it? When you do need it, save the existing content and restore it afterwards.
      >
      > 4. Add an underscore to the beginning of the listbox content, that way there will be a selection bar at the top of the wizard, and it can be advanced using the keyboard.
      >
      > Hope helpful.
      >
      > Regards,
      > Sheri
      >
      -------------------------------------------------

      This was very helpful! Thank you!
      Dirk

      ADAPTED CLIP
      -------------------------------------------------
      H="Navigate Outline"
      ;check if outline if not end
      ^!If ^$IsOutlineDoc$ = 1 Skip_2 ELSE Next
      ^!Info No outline! Clip stops.
      ^!Goto End

      ;save document
      ^!Save

      ;loop to gather topic headings
      ^!Set %Counter%=1
      ^!Set %Headings%=
      :GatherHeadings
      ^!If ^%Counter% > ^$GetTopicCount$ SortHeadings
      ^!Set %Headings%=^%Headings%^$GetTopicName(^%Counter%)$|
      ^!Inc Counter
      ^!GoTo GatherHeadings

      :SortHeadings
      ^!Set %Headings%=^$StrSort("^%Headings%";False;True;False)$

      ;wizard
      ^!SetWizardWidth 150
      ^!Set %ChoosenHeading%=^?{(T=L;H=34)Which heading=_^%Headings%}

      ;goto choosen headng
      ^!TopicShow "^%ChoosenHeading%"
      ^!FocusDoc

      ;clear variables
      ^!ClearVariable ^%Counter%
      ^!ClearVariable ^%Headings%
      ^!ClearVariable ^%ChoosenHeading%
    • Show all 6 messages in this topic