TIP: Click on subject to list as thread! ANSI
echo: semware
to: All
from: `Dalton Spence`
date: 2003-01-16 03:45:32
subject: [TSEPro] Re: Using .ui file procedures in external macros

From: "Dalton Spence" 
@Date: Wed, 15 Jan 2003 12:15:32 -0500
@Sender: semware-owner{at}sawasdi.apana.org.au



----- Original Message -----
From: "Sammy Mitchell" 
Sent: Tuesday, January 14, 2003 7:18 PM

> In version 4 of TSE Pro, public procedures can be called via
> external macros.  For example:
>
> ---------foo.s---------------------------------------------
> public proc doit()
>     MsgBox("", "Hello from foo!")
> end
>
> ---------bar.s---------------------------------------------
> proc main()
>     ExecMacro("foo", "doit")
> end
>
> When you run bar.mac, assuming assuming foo.mac exists, the
> doit procedure in foo will run.
>
> And, you can do the same thing with your .ui file:
>
> ---------tse.ui--------------------------------------------
> public proc mEmptyClipboard()
>     EmptyBuffer(Query(ClipboardId))
> end
>
> ---------test.s--------------------------------------------
> proc main()
>     ExecMacro(".ui", "mEmptyClipboard") // note
".ui"
> end
>
> What good is this?
>
> 1) You can have a macro library, that is shared by multiple
> macros.  While simply #including the relevant code also
> works, the macro library sometimes offers a better solution.
>
> 2) This also opens up .ui file routines to external macros.
>
> 3) Since the parameters to ExecMacro() are strings, this can
> potentially be used for a sort of poor mans dynamic linking
> facility within the macro language.
>
> What is bad about this?
>
> 1) The syntax is ugly: ExecMacro(macro-filename, public-macroname)
>
> Perhaps in a future version we could just type:
> macro-filename.public-macroname()
>
> 2) Declaring the proc as "public" also makes it show up in
> the publics list.  For "library" routines, it probably
> should not show up there.
>
> 3) Only procs without parameters are supported in this
> version.  Bummer.

Too bad you can't make *menus* public. An ExecMenu command could be
*really* useful here. Half a mo' . . . include the following code in the UI
somewhere after the last pull-down menu is defined.

/**************************************************************************
  TSE User Interface Pull-Down Menu Procedures for external use

**************************************************************************/

public proc uiFileMenu()
    FileMenu()
end

public proc uiClipMenu()
    ClipMenu()
end

public proc uiWindowMenu()
    WindowMenu()
end

public proc uiBlockMenu()
    BlockMenu()
end

public proc uiSearchMenu()
    SearchMenu()
end

public proc uiPrintMenu()
    PrintMenu()
end

public proc uiMacroMenu()
    MacroMenu()
end

public proc uiTextMenu()
    TextMenu()
end

public proc uiUtilMenu()
    UtilMenu()
end

public proc uiOptionsMenu()
    OptionsMenu()
end

public proc uiHelpMenu()
    HelpMenu()
end

/**************************************************************************
/

This allows you to use the default menus in your customized menubar as
below.

/**************************************************************************
**
  TSE Pull-down Menus

***************************************************************************
/

menubar MainMenu()
    history

    "&File"    ,    ExecMacro(".ui","uiFileMenu")
    "&Text"    ,    ExecMacro(".ui","uiTextMenu")
    "&Search"  ,    ExecMacro(".ui","uiSearchMenu")
    "&Block"   ,    ExecMacro(".ui","uiBlockMenu")
    "&Clip"    ,    ExecMacro(".ui","uiClipMenu")
    "&Window"  ,    ExecMacro(".ui","uiWindowMenu")
    "&Macro"   ,    ExecMacro(".ui","uiMacroMenu")
    "&Print"   ,    ExecMacro(".ui","uiPrintMenu")
    "&Util"    ,    ExecMacro(".ui","uiUtilMenu")
    "&Options" ,   
ExecMacro(".ui","uiOptionsMenu")
    "&Help"    ,    ExecMacro(".ui","uiHelpMenu")
end

Any one of the above options could be replaced with a customized local
menu, or a whole new menu could be added to them. What do you think?

--
              {at}=================================================={at}
              | Dalton S. Spence, B.Sc.  |
              | Home Page: http://www.hwcn.org/~ag775/home.html  |
              |      Family Motto: Virtute Acquiritur Honos      |
              |   Your sister traveled to Hell and amuses the    |
              |                 terminal. FNORD!                 |
              {at}=================================================={at}


--
TSEPro mailing list



---
[sawasdi.apana.org.au] (3:800/846.13)
* Origin: apana>>>>>fidonet
SEEN-BY: 633/267 270
@PATH: 800/846 1 640/954 774/605 123/500 106/1 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.