English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System

 
 
Thread Tools
Old 27 June 2021, 21:26   #1
Crispy
Registered User
 
Join Date: Oct 2020
Location: Sunhillow
Posts: 6
Bug in v34 prop gadget?

I have a vertical prop gadget attached to a window. The gadget is 25 lines tall, and VertBody is set to 32768. I'm running the program in OS 1.3, and when I click in the container below the knob, the knob moves all the way to the bottom, and VertPot is set to 65535, as it should be. However, if I drag the knob all the way to the bottom, then VertPot gets set to a value less than 65535. Usually this value is 58982, but not always.

I've been through the Intuition documentation several times, and I really can't see where the problem lies. Is this a v34 intuition.library bug, or am I doing something wrong in my code?

Code:
/*---------------------------------------------------------------------
//---------------------------------------------------------------------
//
//	Title: Prop Gadget Test
//
//  File - proptest.c
//  Project - _PRODUCT
//  Version - _VERSION
//  Author - _AUTHOR 
//
//	Compiler - Lattice C 5.04
//	lc gui.c
//	blink from lib:c.o proptest.o lib lib:lc.lib lib:amiga.lib to proptest
//
//---------------------------------------------------------------------
//-------------------------------------------------------------------*/

/********************************************************************** 
* INCLUDE
**********************************************************************/

#include <stdio.h>
#include <exec/types.h>
#include <intuition/intuition.h>
#include <proto/exec.h>
#include <proto/intuition.h>


/********************************************************************** 
* DEFINES
**********************************************************************/

#define VERSION "\0$VER: proptest 1.0 (27.6.2021)"


/********************************************************************** 
* PROTOTYPES
**********************************************************************/

void Cleanup(void);


/********************************************************************** 
* GLOBAL VARIABLES
**********************************************************************/

struct Window *Window = NULL;
struct Gadget ScrollGadget;
struct Image ScrollImage;
struct PropInfo ScrollInfo;
BYTE *VersionStr = VERSION;


/********************************************************************** 
* MAIN CODE
**********************************************************************/

int main(int argc, char *argv[])
{
	int	run = 1;
	struct Gadget *GadgetPtr;
	struct NewWindow NewWindow;
	struct IntuiMessage *Msg;
	struct PropInfo *PropPtr;


	IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 0);
	if (IntuitionBase == NULL)
		return 10;

	ScrollGadget.NextGadget = NULL;
	ScrollGadget.LeftEdge = 240;
	ScrollGadget.TopEdge = 10;
	ScrollGadget.Width = 16;
	ScrollGadget.Height = -10;
	ScrollGadget.Flags = GADGHNONE|GRELHEIGHT;
	ScrollGadget.Activation = GADGIMMEDIATE|RELVERIFY;
	ScrollGadget.GadgetType = PROPGADGET;
	ScrollGadget.GadgetRender = (APTR)&ScrollImage;
	ScrollGadget.SelectRender = NULL;
	ScrollGadget.GadgetText = NULL;
	ScrollGadget.MutualExclude = 0;
	ScrollGadget.SpecialInfo = (APTR)&ScrollInfo;
	ScrollGadget.GadgetID = 0x100;
	ScrollGadget.UserData = NULL;

	ScrollInfo.Flags = AUTOKNOB|FREEVERT;
	ScrollInfo.HorizPot = 0;
	ScrollInfo.VertPot = 0;
	ScrollInfo.HorizBody = MAXBODY;
	ScrollInfo.VertBody = 32768;

	NewWindow.TopEdge = 11;
	NewWindow.LeftEdge = 0;
	NewWindow.Width = 256;
	NewWindow.Height = 35;
	NewWindow.DetailPen = 0;
	NewWindow.BlockPen = 1;
	NewWindow.Title = "Prop Test";
	NewWindow.Flags = WINDOWCLOSE|WINDOWDRAG|WINDOWDEPTH|SMART_REFRESH|ACTIVATE;
	NewWindow.IDCMPFlags = CLOSEWINDOW|REFRESHWINDOW|GADGETUP;
	NewWindow.Type = WBENCHSCREEN;
	NewWindow.FirstGadget = &ScrollGadget;
	NewWindow.CheckMark = NULL;
	NewWindow.Screen = NULL;
	NewWindow.BitMap = NULL;
	NewWindow.MinWidth = 256;
	NewWindow.MinHeight = 35;
	NewWindow.MaxWidth = 256;
	NewWindow.MaxHeight = 58;

	if ((Window = (struct Window *)OpenWindow(&NewWindow)) == NULL) {
		Cleanup();
		return 10;
	}

	while (run) {
		Wait(1L << Window->UserPort->mp_SigBit);
		while ((Msg = (struct IntuiMessage *) GetMsg(Window->UserPort)) != NULL) {
			GadgetPtr = (struct Gadget *)Msg->IAddress;
			switch (Msg->Class) {
				case CLOSEWINDOW :
					run = 0;
					break;
				case REFRESHWINDOW :
					BeginRefresh(Window);
					EndRefresh(Window, TRUE);
					break;
				case GADGETUP :
					printf("** GADGETUP **\n");
					if (GadgetPtr->GadgetID == 0x100) {
						PropPtr = (struct PropInfo *)ScrollGadget.SpecialInfo;
						printf("VertPot: %u\n\n", PropPtr->VertPot);
					}
					break;
				default :
					break;
			}
			ReplyMsg((struct Message *)Msg);
		}
	}				

	Cleanup();
	return 0;
}


/********************************************************************** 
* CLEANUP
**********************************************************************/

void Cleanup(void)
{
	
	if (Window != NULL) {
		CloseWindow(Window);
		Window = NULL;
	}

	if (IntuitionBase != NULL) {
		CloseLibrary((struct Library *)IntuitionBase);
		IntuitionBase = NULL;
	}

}
Crispy is offline  
Old 27 June 2021, 22:49   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
I've seen similar things happen, with a horizontal scroll bar, though.

Check with Kick 3.1. If it works better there, then it's a bug in 1.3.
thomas is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
V34 Bugs in IEEEDPFieee and RawDoFmt phx Coders. System 10 03 June 2019 12:06
Kickstart 1.3 (v34) Execute without c:run matburton Coders. System 15 30 April 2018 10:58
Prop-Gadgets in Window Border HowTo? AGS Coders. System 6 11 December 2013 19:20
Alien Breed 3D Blaster plastic prop gun Cherno Nostalgia & memories 0 11 October 2013 01:53
Gadget/Layout.gadget V44 ruliovega support.Apps 6 02 January 2006 11:50

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:18.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.13686 seconds with 13 queries