[comp.sys.amiga.programmer] Help on string gadgets necessary

cpmwc@marlin.jcu.edu.au (Matt Crowd) (03/20/91)

After playing around with string gadgets for a few weeks I can't get
a couple of things to work.

	1. Having the cursor appear in a specified gadget ie. not having
	   to select it first.

	2. Gadget in general - After OffGadget i have used OnGaget to
	   turn it back on and there is still ghosting in the gadget,
	   the area free of ghosting is where the Gadget Text was, I   
	   have tried RefreshGadgets and RefreshGagetList(?) but they
	   seem to have no effect, any ideas much appreciated !

thanks, matt.

steed@digitm.UUCP (Steed Kulka) (03/21/91)

In article <1991Mar20.015546.1131@marlin.jcu.edu.au>cpmwc@marlin.jcu.edu.au
(Matt Crowd) writes:

>	1. Having the cursor appear in a specified gadget ie. not having
>	   to select it first.

Try with ActivateGadget()

>	2. Gadget in general - After OffGadget i have used OnGaget to
>	   turn it back on and there is still ghosting in the gadget,

Detach the gadget from the gadlist, reset gad->Flags GADGDISABLED, add the
gadget back to its list, and RefreshGList(). If I remember well, this works
fine if you have provided an Image for your gadget rendering - never tried
if it works without.


--
  _     _   _  ___ __        
 (_)   | \|/ _| | |_  /\ |\/|   Steed Kulka
-----  |_/|\_/| | |__/--\|  |   "Life starts at '030"

BIX: digiteam
UUCP: {uunet|pyramid|rutgers}!cbmvax!cbmehq!cbmita!digitm!steed

s37732v@vipunen.hut.fi (Markus Juhani Aalto) (03/25/91)

   After playing around with string gadgets for a few weeks I can't get
   a couple of things to work.

	   1. Having the cursor appear in a specified gadget ie. not having
	      to select it first.

If you are opening a window with string gadget in it, you have to make
it active via WINDOWACTIVE flag. Then wait for ACTIVEWINDOW message
from IDCMP-port and after that call ActiveGadget()-routine (I don`t
remember exact name now, but it should be something like that.) Well,
atleast it worked for me!

	   2. Gadget in general - After OffGadget i have used OnGaget to
	      turn it back on and there is still ghosting in the gadget,
	      the area free of ghosting is where the Gadget Text was, I   
	      have tried RefreshGadgets and RefreshGagetList(?) but they
	      seem to have no effect, any ideas much appreciated !

Can`t try it now! But it should work if you first call OnGadget and
then RefreshGadgets. If it wont work, try removing gadget first from
the list and then calling OnGadget and AddingGadget back to the list
and Refreshing them. This might work, but as I said I can`t try it
myself now and because Intuition programming isn`t just piece of cake 
I wont give any promises.
--


***********************************************************************
*  Markus.Aalto@hut.fi    |       Only Amiga makes it possible!!!!    *
*  s37732v@vipunen.hut.fi |                                           *
*  s37732v@puukko.hut.fi  |       Yeah! It's a sure thing!            *
*  maalto4@otax.hut.fi    |       :^)                                 *
***********************************************************************
        

peraue@cs.vu.nl (Raue Paul Erik) (04/02/91)

s37732v@vipunen.hut.fi (Markus Juhani Aalto) writes:


>   After playing around with string gadgets for a few weeks I can't get
>   a couple of things to work.

>	   1. Having the cursor appear in a specified gadget ie. not having
>	      to select it first.

>If you are opening a window with string gadget in it, you have to make
>it active via WINDOWACTIVE flag. Then wait for ACTIVEWINDOW message
>from IDCMP-port and after that call ActiveGadget()-routine (I don`t
>remember exact name now, but it should be something like that.) Well,
>atleast it worked for me!

ActivateGadget( struct Gadget *g, struct Window *w, struct Requester *r );

So if you're using a regular window (pointer called winptr) and a gadget
called StringGadget use the following call:

ActivateGadget( &StringGadget, winptr, NULL );

>	   2. Gadget in general - After OffGadget i have used OnGaget to
>	      turn it back on and there is still ghosting in the gadget,
>	      the area free of ghosting is where the Gadget Text was, I   
>	      have tried RefreshGadgets and RefreshGagetList(?) but they
>	      seem to have no effect, any ideas much appreciated !

>Can`t try it now! But it should work if you first call OnGadget and
>then RefreshGadgets. If it wont work, try removing gadget first from
>the list and then calling OnGadget and AddingGadget back to the list
>and Refreshing them. This might work, but as I said I can`t try it
>myself now and because Intuition programming isn`t just piece of cake 
>I wont give any promises.

I've noticed this problem myself. It seems that Intuition only redraws
the pieces of a gadget containing an actual image. This means that your
string gadget is only redrawn where there is an image, so the border
and the text in the gadget is redrawn, but any area where there's no
border and no text and is still in the gadget remains ghosted.
If the suggestion mentioned in the previous reply doesn't work, you'll
probably have to remove the gadgetimage from the screen using RectFill
and then calling OnGadget.

Good luck, Paul-Erik Raue

     _______       _______    _______   +-----------------+--------------------+
    / ___  /\     / _____/\  / ___  /\  | peraue@cs.vu.nl | Quote by DD.Linder |
   / /\_/ /_/___ / /\____\/ / /\_/ / /  +-----------------+--------------------+
  / _____//____// ____/\   / __  _/ /   | real programmers don't document code |
 / /\____\\____/ /\___\/_ / /\_\ \\/    | if it was hard to write, it should   |
/_/ /         /______//_//_/ /  \_\     | be hard to read.                     |
\_\/          \______\\_\\_\/    \_\    +--------------------------------------+