| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | [TSEPro] Re: ideas for macor programming? |
From: "Sammy Mitchell"
@Date: Mon, 10 Feb 2003 10:53:11 -0500
@Sender: semware-owner{at}sawasdi.apana.org.au
>TSEPro3.0c is the version
[company-man-mode on]
You would love version 4. Really.
[company-man-mode off]
>List() and LList() look interesting. Their syntax is
>listed as "INTEGER", so I expect they return a number. I
>would expect to return 0,
Correct.
>and to return the current line number within the
>list. Does that sound right?
Nope. returns non-zero. To get the line number, use
CurrLine(). Generally, List() returns 1 on success. However,
that can be changed.
One can "hook" into the list processing, and, exit the list
based on certain conditions, using the EndProcess()
function. The argument passed to EndProcess() is the value
that List() would return. For a simple example:
---------------cut here-----------------------------------------
// start our constants at 2 so as not to interfere with
constant kF1 = 2, kF2, kF3
// our special keydef
// EndProcess() will terminate the list()
// List is a special form of Process()
keydef mykeys
EndProcess(kF1)
EndProcess(kF2)
EndProcess(kF3)
end
// a footer string to let the user know what is going on
string LIST_FOOTER[] =
"{Enter}-Accept {F1}-Quit1 {F2}-Quit2 {F3}-Quit3 {Escape}-Cancel"
// enable our keydef and the footer string
proc onListStartup()
if Enable(mykeys)
ListFooter(LIST_FOOTER)
endif
// so we won't be called by someone else's list()
Unhook(onListStartup)
end
proc main()
integer id, result
PushPosition() // save where we are
id = CreateTempBuffer()
// populate the buffer
AddLine("hello")
AddLine("nothing much to say")
AddLine("this is all")
// this will be called at list startup processing
Hook(_LIST_STARTUP_, onListStartup)
// result will contain the value of EndProcess()
// TSE uses 0 for , 1 for
// other values are user defined
result = List("This is an example",
Max(LongestLineInBuffer(), Length(LIST_FOOTER)))
// display how the list() was terminated
case result
when 0 MsgBox("", "You pressed ")
when kF1 MsgBox("", "You pressed ")
when kF2 MsgBox("", "You pressed ")
when kF3 MsgBox("", "You pressed ")
otherwise MsgBox("", "You pressed ")
endcase
// restore previous position
PopPosition()
// get rid of temporary buffer
AbandonFile(id)
end
---------------cut here-----------------------------------------
I'm probably leaving out a lot of non-obvious details. If
so, feel free to ask.
>It looks like I'll also have to learn more about buffers,
>if I want to go this route.
Yes, that would be a good idea. But once you get the hang
of it, it isn't too bad.
>As my pick lists are short and rather static, I'm wondering
>if menu() might work. Each item on the menu would call the
>same procedure with a different parameter, that procedure
>would update a global variable, and then my primary
>procedure could place that data where I want it to go on
>the line.
Yes, a menu might work.
When to use menus:
- Number of selections are static at compile time
- Selections themselves are static at compile time
- Less than screen-height - 2 selections
When to use List():
- Number of selections is unknown at compile time
- Selections themselves are variable at compile time
- Possibly more than screen-height - 2 selections
>Any additional thoughts?
You might also want to investigate MsgBoxEx().
>P.S. I'm only going on a "binge" here, I promise to not be
>asking these newbie questions for too long!
Feel free to. I'm sure some others appreciate it.
>(can't just have fun with SAL, have to do some real work,
>too.) :)
I know what you mean!
--
Sammy Mitchell
--
TSEPro mailing list
---
[sawasdi.apana.org.au] (3:800/846.13)
* Origin: apana>>>>>fidonetSEEN-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™.