Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
35 user(s) are online (26 user(s) are browsing Forums)

Members: 0
Guests: 35

more...

Support us!

Headlines

 
  Register To Post  

Gadtools crash whit DSI error, what's up.
Home away from home
Home away from home


See User information


#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <intuition/gadgetclass.h> 
#include <proto/gadtools.h>

struct Screen        *src;

void GT_configurestruct NewGadget *ng,int id,int x,int y,int w,int h)
{
    
bzero(ng,sizeof(struct NewGadget));

    
ng -> ng_LeftEdge x;
    
ng -> ng_TopEdge y;
    
ng -> ng_Width w;
    
ng -> ng_Height h;
    
ng -> ng_GadgetID id;
    
ng -> ng_VisualInfo GetVisualInfo(srcTAG_DONE );
    
ng -> ng_TextAttr 0;

    
ng -> ng_Flags 0;
}


int main()
{
    
struct NewGadget ng;
    
struct Window    *win;
    
void            *head NULL;
    
void            *next NULL;

    
src LockPubScreen(NULL);
     
win OpenWindowTags (NULL,
        
WA_Title,NULL,
        
WA_Left0,
        
WA_Top0,
        
WA_Width200,
        
WA_Height200,
        
WA_Flags0,
        
WA_IDCMP,
        
IDCMP_MOUSEMOVE IDCMP_CLOSEWINDOW IDCMP_MOUSEBUTTONS |
        
IDCMP_GADGETUP IDCMP_GADGETDOWN
        
TAG_END);

     
GT_configure( &ng,2000,1,1,20,200);

    
next CreateContext( (void *) &head ); 

    
next CreateGadget(SCROLLER_KINDnext, &ng,
        
GTSC_Top0,
        
GTSC_Total1070,
        
GTSC_Visible1020,
        
GTSC_Arrows13,
        
GACT_IMMEDIATETRUE,
        
GACT_RELVERIFYTRUE
        
PGA_Freedom0,
        
TAG_DONE);
    
    
CloseWindow(win);
    
UnlockPubScreen(NULL,src);

}


Edited by LiveForIt on 2011/12/12 16:11:27
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Gadtools crash whit DSI error, what's up.
Supreme Council
Supreme Council


See User information
I'm guessing it's the call to GetVisualInfo() with an uninitialised pointer. You dont assign "scr" to a valid screen pointer until afterwards.

Simon

Comments made in any post are personal opinion, and are in no-way representative of any commercial entity unless specifically stated as such.
----
http://codebench.co.uk
Go to top
Re: Gadtools crash whit DSI error, what's up.
Home away from home
Home away from home


See User information

Thats not it, src is set before GetVisualInfo(), read the code again.

if I replace

next = CreateGadget(SCROLLER_KIND, next, &ng, ...

whit

next = CreateGadget(BUTTON_KIND, next, &ng,TAG_DONE);

Then every thing works.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Gadtools crash whit DSI error, what's up.
Quite a regular
Quite a regular


See User information
@LiveForIt:

Quote:

...read the code again.


That's not the best way to reply when someone offers help. He's unlikely to bother again.

You didn't say where it crashed. That might help.


cheers
tony
Go to top
Re: Gadtools crash whit DSI error, what's up.
Just can't stay away
Just can't stay away


See User information
@LiveForIt

Quote:

GACT_IMMEDIATE, TRUE,
GACT_RELVERIFY, TRUE,


This part should be:
GA_Immediate, TRUE,
GA_RelVerify, TRUE,

GA_Immediate and GA_RelVerify are tags, GACT_IMMEDIATE and GACT_RELVERIFY are flags used for the Activation field of struct Gadget.

Go to top
Re: Gadtools crash whit DSI error, what's up.
Home away from home
Home away from home


See User information
@tonyw

Excuse me if I sounded rude, not my intention.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Gadtools crash whit DSI error, what's up.
Home away from home
Home away from home


See User information
@salass00

Thanks worked perfectly.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top

  Register To Post

 




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




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project