Page 1 of 1

Loading Mouse Pointers - (Fixed)

Posted: Thu Aug 15, 2013 1:52 am
by gonegahgah
I found some code at
This helped me to write the code at the bottom.

There seems to be something missing. I say that because when I use this I get a corrupt image.
Now the funny thing is if I run OWB the corruption goes away.
I can do this with my app open and the corruption just automatically disappears in my app?

So OWB is obviously doing something to correct something in the background that fixes things live?

Can someone help me?


Code: Select all

	pSelf->ad_TextPointerIcon = pSelf->ad_IIcon->GetIconTags(NULL,
		ICONGETA_GetDefaultName,    "textpointer",
		ICONGETA_FailIfUnavailable, TRUE,
	pSelf->ad_TextPointer = MakePointerFromIcon(pSelf,
		pSelf->ad_TextPointerIcon, pSelf->ad_Window->WScreen);

Object *MakePointerFromIcon(struct AppData *pSelf,
	struct DiskObject *pIcon, struct Screen *pScreen)
	UBYTE *pIconImage;
	int32 iWidth, iHeight;

	// Remap icon image; actually I don't understand why remapping is even required for a sprite?
	pSelf->ad_IIcon->LayoutIcon(pIcon, (struct Screen *) ~0UL,

	// Get the image data and its width and height.
		ICONCTRLA_GetImageData1, &pIconImage,
		ICONCTRLA_GetWidth,      &iWidth,
		ICONCTRLA_GetHeight,     &iHeight,
		uint32 iXOffset, iYOffset;

		// Get the XOffset specified in the tooltypes.
		char *pFind = (char *) pSelf->ad_IIcon->FindToolType(
			pIcon->do_ToolTypes, "XOFFSET");
		IDOS->StrToLong(pFind, &iXOffset); // Defaults to 0.
		// Get the YOffset specified in the tooltypes.
		pFind = (char *) pSelf->ad_IIcon->FindToolType(
			pIcon->do_ToolTypes, "YOFFSET");
		IDOS->StrToLong(pFind, &iYOffset); // Defaults to 0.

		// Create the pointer object that you can set for window.
		Object *pPointer =
			pSelf->ad_IIntuition->NewObject(NULL, "pointerclass",
			POINTERA_ImageData, pIconImage,
			POINTERA_Width,     iWidth,
			POINTERA_Height,    iHeight,
			POINTERA_XOffset,   -iXOffset,
			POINTERA_YOffset,   -iYOffset,

		return pPointer;
	return NULL;

Re: Loading Mouse Pointers

Posted: Thu Aug 15, 2013 11:10 am
by gonegahgah
Case of spot the difference I guess...
Seems I do have to specify POINTERA_BitMap which I thought I could get by without doing so...
All works fine now.

I am curious why I would get the pointer imagery from OWB coming through?
It wasn't just the text pointer but whatever pointer over change had occurred last.
I could only find a text pointer and a hand pointer in OWB.
If either were the last over area pointer image they would then also appear in my app when I moved the mouse over a

Wonder why that would be?
I also wonder why the default fall back icon was an indistinct nothing and then become whatever OWB last changed its pointer to?
How does my app pull across something brought into being by another app?

Anyhow, hopefully no-one will benefit from seeing my cheesy looking fall-back mouse pointer. :/
I guess that was what someone else on some other forum was talking about now...
I think the user would prefer the standard default pointer than my cheesy attempt at one :O

Ah, well, all very amusing 8().
They are unlikely to see the poor fallback substitute anyway so I won't fret. LOL.