TIP: Click on subject to list as thread! ANSI
echo: semware
to: All
from: `Jan A. Nauta`
date: 2003-02-11 23:27:32
subject: [TSEPro] Re: Replacement for: binary [`getshift.bin`]? (Re: Message

From: "Jan A. Nauta" 
@Date: Tue, 11 Feb 2003 13:57:32 +0100
@Sender: semware-owner{at}sawasdi.apana.org.au



20030211

Hi Sammy and Bill,

Thanks for the help on this problem.

Yes, I am trying to determine when shift is pressed in conjunction with a
key. Bill did let me know of the existance of the command GetKeyFlags. That
solves part of the problem. I guess that I have to get acquainted with the
new possibilities of TSE for Windows.

But the crux of the problem still exists: to discriminate between shifted
(hot)keybindings and not-shifted (hot)keybindings.
I have made three examples to state my case: example1 is my current TSE1.00
configuration, examples 2 and 3 are experiments to translate that
configuration to the new TSE4.00 software.

Yes, I know of the new keybinding type:  that I could use in
this instance. But I have a lot of AFTER-hotkeybinding-procs that depend on
checking the Shiftkey status. And because of the fact that my TSE.UI hovers
near the maximum-to-be-used macro space AND because of my somewhat lazy
nature when it comes to reprogram a working hunk of code ... Well, I
honestly don't know what method occupies the least amount of macro space
(have to find out: there are some OS environments where the DOS version of
TSE behaves very awkwardly. That's not due to TSE but to the OS - Win2K for
example. So I have to use the Windows version of TSE).
Therefore it would be useful to know how I can set the map switch of the SAL
compiler to default to TRUE when compiling an .s file.

Again, thanks in advance for any help on this. Have to earn a living now.

Jan

/*** EXAMPLE1 using GetShiftState()    ************************ INFO  **/
/*
| SOFTWARE:    TSE v1.00A
********************************************************************** */
binary ["getshift.bin"]
integer proc GetShiftState() : 0
end

/*** ShiftKeyPressed                   ************************ INFO  **/
/*
| TSE version:  1.00A
| DATE:         11-02-03
| DESCRIPTION:  Sort of oldfashioned GetKeyFlags
|
| RETURNS:      Just the state of the Shiftkeys
********************************************************************** */

integer proc ShiftKeyPressed()  /* Returns ShiftState.
    */
    Return(GetShiftState() & 3h)
end ShiftKeyPressed

/*** InsertFileOrRuler                 ************************ INFO  **/
/*
| TSE version:  1.00A
| DATE:         11-02-03
| DESCRIPTION:  Object is: to run the proc mRuler if the ShiftKey is down
|                          or to insert a file if the ShiftKey is up.
|
| NOTES:        This does work.
|
|               In the TSE version 1.00A there isn't a discrimination
|               between  and  in the keybindings, so
|               whichever hotkey you push, the proc InsertFileOrRuler
|               does run.
********************************************************************** */

proc InsertFileOrRuler()
    if ShiftKeyPressed()
        Warn("Run proc mRuler; Shiftkey is down")   // mRuler()
    else
        Warn("Run command InsertFile(); Shiftkey is up")// InsertFile()
    endif
end InsertFileOrRuler

                      InsertFileOrRuler()

/*** EXAMPLE2 using GetKeyState(...)   ************************ INFO  **/
/*
| SOFTWARE:    TSE v4.00d
********************************************************************** */
// Declare Function GetKeyState Lib "user32" Alias "GetKeyState"
//                                  (ByVal nVirtKey As Long) As Integer

dll ""
integer proc GetKeyState(integer nVirtKey)
end

constant VK_SHIFT = 10h                 // hex value for SHIFT key

/*** ShiftKeyPressed                   ************************ INFO  **/
/*
| TSE version:  4.00d
| DATE:         11-02-03
| DESCRIPTION:  Sort of oldfashioned GetKeyFlags (again)
|
| RETURNS:      Just the state of the Shiftkeys
********************************************************************** */

integer proc ShiftKeyPressed()  /* Returns ShiftState.
    */
    Return(GetKeyState(VK_SHIFT) & 80h)
end ShiftKeyPressed

/*** InsertFileOrRuler                 ************************ INFO  **/
/*
| TSE version:  4.00d
| DATE:         11-02-03
| DESCRIPTION:  Object is: to run the proc mRuler if the ShiftKey is down
|                          or to insert a file if the ShiftKey is up.
|
| NOTES:        This doesn't work: you never get the mRuler running.
|
|               In the TSE version 1.00A there wasn't a discrimination
|               between  and  in the keybindings, so
|               whichever hotkey you pushed, the proc InsertFileOrRuler
|               did run.
|
|               I guess something has changed in the TSE version 4.00d:
|               there must be that discrimination between the two hotkeys
|               mentioned above.
********************************************************************** */

proc InsertFileOrRuler()
    if ShiftKeyPressed()
        Warn("Run proc mRuler; Shiftkey is down")   // mRuler()
    else
        Warn("Run command InsertFile(); Shiftkey is up")// InsertFile()
    endif
end InsertFileOrRuler

                      InsertFileOrRuler()

/*** EXAMPLE3 using GetKeyFlags()      ************************ INFO  **/
/*
| SOFTWARE:    TSE v4.00d
********************************************************************** */
/*** InsertFileOrRuler                 ************************ INFO  **/
/*
| TSE version:  4.00d
| DATE:         11-02-03
| DESCRIPTION:  Object is: to run the proc mRuler if the ShiftKey is down
|                          or to insert a file if the ShiftKey is up.
|
| NOTES:        This doesn't work: you never get the mRuler running.
|
|               In the TSE version 1.00A there wasn't a discrimination
|               between  and  in the keybindings, so
|               whichever hotkey you pushed, the proc InsertFileOrRuler
|               did run.
|
|               I guess something has changed in the TSE version 4.00d:
|               there must be that discrimination between the two hotkeys
|               mentioned above.
********************************************************************** */

proc InsertFileOrRuler()
integer flags = GetKeyFlags()
    if flags & (_LEFT_SHIFT_KEY_|_RIGHT_SHIFT_KEY_)
        Warn("Run proc mRuler; Shiftkey is down")   // mRuler()
    else
        Warn("Run command InsertFile(); Shiftkey is up")// InsertFile()
    endif
end InsertFileOrRuler

                      InsertFileOrRuler()


> Hello!
>
> For some reason, sometimes our mailing list software refuses to deliever
> a particular message.  I don't know why this is so.  Anyway, yours is
> one of the unlucky messages.
>
> But the good news is, that, on second submission, they always seem to go
> through.
>
> So, could you kindly resend your message to the tsepro mailing list?
>
> Here are my answers to your questions:
>
> >In the Semware editor 1.0 you could use the directive:
> >binary to include a procedure that you couldn't write using
> >SAL alone. I wrote a lot of macros that depend on that
> >possibility. Now that I have bought TSEPro4 there is a
> >different method (DLL) to do the same but I can't seem to
> >get it right.
> >
> >This is the code I made:
>
> 
>
> >If I compile this and subsequently push the buttons:
> >   , , , ,
  ( and in between the OK
> button
> >from the Warn Popup)
> >I get the values:
> >    0,    -128,      0,    -127,       1
> >
> >What do I do wrong?
>
> You did not do anything wrong.  Your code appears to be
> working just fine.  Remember to check the high-order bit to
> see if shift is pressed.
>
> Also, there is possibly some interaction or side-effect
> because this is being called after TSE has done all of its
> gyrations with the key.
>
> Are you trying to determine when shift is pressed in
> conjunction with a key?
>
> >By the way: Is there a list with commands that were valid
> >in TSE1.0 and are not in TSEPro4?
>
>
> The following commands have changed:
>
>   ForceChanged()      | both commands have been removed and
>   isChanged()         | replaced by FileChanged()
>
>   GetClipBoardId()    | both commands have been removed and
>   SetClipBoardId()    | replaced by the editor variable ClipBoardId.
>
>   LoCase()            | replaced by Lower()
>   UpCase()            | replaced by Upper()
>
>   ShowHelp()          | renamed to QuickHelp()
>
>   GeneratePickBuffer  | replaced by BuildPickBufferEx
>
>
> The following keywords have changed:
>
>   Data                | changed to DataDef
>   Help                | changed to HelpDef
>
> The following editor variables have changed:
>
>   BufferType
>
>   BufferType editor variable removed and replaced with the
>   BufferType() command.
>
>   Syntax is:  INTEGER BufferType([INTEGER flag]) If 'flag' is
>   passed, the current buffer type is set to 'flag', else the
>   current buffer type is returned.
>
> >And: Is it possible to use bookmarks in the TSEPro4 Help
> >section?
>
> No, but that is an execellent suggestion - thanks!
>
> >And: Is there a list with Error numbers with their
> >meanings?
>
> No, but there should be.  The explanation is basically in
> the error message.  We don't have a list of any additional
> meanings.
>
> --
> Sammy Mitchell - www.semware.com
>
>
>
>
> From: "Jan A. Nauta" 
> To: 
> Subject: Replacement for: binary ["getshift.bin"]?
> Date: Sun, 9 Feb 2003 05:08:16 +0100
>
>
> 20030208
>
> Hi there,
>
> In the Semware editor 1.0 you could use the directive: binary to include
> a
> procedure that you couldn't write using SAL alone. I wrote a lot of
> macros
> that depend on that possibility.
> Now that I have bought TSEPro4 there is a different method (DLL) to do
> the
> same but I can't seem to get it right.
>
> This is the code I made:
>
> // Declare Function GetKeyState Lib "user32" Alias
"GetKeyState" (ByVal
> nVirtKey As Long) As Integer
>
> dll ""
> integer proc GetKeyState(integer nVirtKey)
> end
>
> constant VK_SHIFT = 10h                 // hex value for SHIFT key
>
> integer proc ShiftKeyPressed()  /* Returns ShiftState.
>     */
>     Return(GetKeyState(VK_SHIFT))
> end ShiftKeyPressed
>
>                        warn(Shiftkeypressed())
>                  warn(Shiftkeypressed())
>
> If I compile this and subsequently push the buttons:
>    , , , ,
  ( and in between the OK
> button
> from the Warn Popup)
> I get the values:
>     0,    -128,      0,    -127,       1
>
> What do I do wrong?
>
> By the way: Is there a list with commands that were valid in TSE1.0 and
> are
> not in TSEPro4?
>
> And: Is it possible to use bookmarks in the TSEPro4 Help section?
>
> And: Is there a list with Error numbers with their meanings?
>
> Thanks in advance for any help.
>
> Jan
>
>
> // eompost 3E45D40B:44BC.1:gfrceb
>
>
>
>


--
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™.