[comp.sys.amiga] window and mouse cursor questions

mkent@violet.berkeley.edu (03/09/87)

   I've been working on a package to make creation and management of
console windows a bit simpler, but I'm having a few problems.  I'd be
eternally grateful if anyone can answer any of the following questions for
me. .  .

   How do you set the pen color of a console window higher than color
number 7?  The "graphics rendition" string ( <CSI>;[30+color-number]m )
works fine for the low color numbers, but it interprets numbers > 40 as
background pen colors (as per the documentation, amazingly).  I notice
SetAPen has no effect on the color of text printed in console windows.
Note that I'm printing in the window using the console device i/o calls,
*not* the text library stuff.

   How can I programmatically control which window is active?  For
instance, I have a window for drawing, in which mouse clicks are
meaningful, but I don't ever want that window to become active (since I
have another window for reading typein and displaying text).  I've found
documentation on how to determine which window's active, but nothing on
how to set this yourself from within a program.

   Last question (for now :-)): how does one programmatically control the
mouse state?  I'd like to move the mouse cursor and simulate button
presses.  I remember about a year ago someone asked a question like this 
and got an amazingly silly answer from a Commodore employee about 
Intuition's mind and body staying together...  Hopefully someone on the 
net actually knows about this.

   Please drop me a line if you have ideas about any of these problems;
I'd really like to get some resolution here. .  .



	.      .     .    .   .  . ... .  .   .    .     .      .

Marty Kent
net:  MKent@violet.berkeley.edu
work: Dept. of EMST / 4527 Tolman Hall / UC Berkeley / Berkeley, Ca. 94720
      415/ 642 0288
home: 1129 Bancroft Way / Berkeley, Ca. 94702
      415/ 548 9129
        .    .  . ... .  .    .        .        .    .  . ... .  .  for 

brent@well.UUCP (Brent Southard) (03/10/87)

Marty, you can 'fake' mouse and keyboard events by messing with the event
stream of the input.device.  You would add simulated events with the
IND_WRITEEVENT command.  Look in the ROM Kernal Manual in the chapter
concerning the Timer device for all the details.  I think this will so what
you want...

	brent

brent@well.UUCP (03/11/87)

In article <2741@well.UUCP> brent@well.UUCP (Brent Southard) writes:
>...
>concerning the Timer device for all the details.  I think this will so what
>you want...
>
Oops.  I obviously meant to tell you to look in the Input device chapter.
I'm using the Developer's pre-release manuals, by the way -- I don't know
what the Addison-Wesley manuals have to say, but its probably the same.

	brent

carolyn@cbmvax.UUCP (03/12/87)

In article <2724@jade.BERKELEY.EDU> mkent@violet.berkeley.edu() writes:
>
>   How do you set the pen color of a console window higher than color
>number 7?  The "graphics rendition" string ( <CSI>;[30+color-number]m )
>works fine for the low color numbers, but it interprets numbers > 40 as
>background pen colors (as per the documentation, amazingly).  I notice
>SetAPen has no effect on the color of text printed in console windows.
>Note that I'm printing in the window using the console device i/o calls,
>*not* the text library stuff.

    Rastport variables for console device Text output are stored in
the ConUnit structure.  The console device modifies the variables
in the ConUnit structure when you write the CSI strings.  At the
start of each write, it temporarily copies those variables to
the window's RastPort so that they are used when it calls Text().
To make the console device print text in a color higher than 7,
you would have to store the color number in conunit->FgPen.
I've been told you should surround your code to modify conunit->FgPen
with a DISABLE/ENABLE pair.  Seems like overkill to me, but...
You should be able to find the pointer to the ConUnit structure
in yourIORequest->io_Unit. (OpenDevice() puts it there).


>   How can I programmatically control which window is active? 

   There is a new 1.2 Intuition function ActivateWindow(window).
To call it, you need to link with 1.2 Amiga.lib.  In addition,
you'll have to specify version 33 when you open intuition.library
so your program can make sure it's being run on a machine with at
least 1.2 OS.  Abort gracefully if the OpenLibrary fails.

   If you don't have 1.2 Amiga.lib, order the 1.2 Native Developer
Update as described another recent posting of mine. 
(Note - if you are using Manx then get a 1.2 Manx update instead)


>   Last question (for now :-)): how does one programmatically control the
>mouse state? 

   You send a false InputEvent.  See the input.device chapter in the
ROM kernal manual.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=