AmiBlitz / AmiBlitz3

Complete package of AmiBlitz3 including all sources.
https://www.amiblitz.de/
121 stars 9 forks source link

GTDisable and GTEnable seem to have no effect on GTShape type gadgets #90

Open FraBro1 opened 8 months ago

FraBro1 commented 8 months ago

I tried it with BlitzBasic too and the behaviour is consistent;

One can disable the GTShape gadget from the start but then it ends up never being usable at all.

honitos commented 8 months ago

can you please provide me a short code example to reproduce this behaviour?

FraBro1 commented 8 months ago

sure.

`;

LoadShape 1,"blitzinc:_dat/iff/getfile.br"

FindScreen 1

Window 1,0,11,600,200,$140f,"hello, click mouse",2,1

GTShape 1,1,100,30,0,1 GTText 1,2,100,50,50,24,"hello",0,"olleh"

AttachGTList 1,1

Repeat MouseWait

  db.w=1-db

  If db=1

    GTEnable 1,1

    WLocate0,0:Print "enabled"
    Redraw1
  Else

    GTDisable 1,1

    WLocate0,0:Print "disabled"
    Redraw1
  EndIf

Until WaitEvent=$200 End `

honitos commented 8 months ago

I tried your code with the original function of gadtools GTSetGadgetAttrsA to disable the shape and it did not work either. I have no experience with gadtools.library, so I am not able to investigate it further. I don't see any problems in the source code of the blitzlib gadtoolslib:

My example code:

WBStartup : NoCli
LoadShape 1,"//data/ball"

FindScreen 1

AddIDCMP #IDCMP_GADGETUP|#IDCMP_GADGETDOWN;|#IDCMP_INTUITICKS
ww.w = 600 : wh.w = 200
wx.w = (ScreenWidth - ww) / 2
wy.w = (ScreenHeight - wh) / 2
Window  1,wx,wy,ww,wh,#WFLG_CLOSEGADGET|#WFLG_DEPTHGADGET|#WFLG_DRAGBAR|#WFLG_GIMMEZEROZERO|#WFLG_ACTIVATE,"hello, click mouse",2,1
*win.Window = Peek.l(Addr Window(1))
Use Window 1

GTShape  1,1,100,30, $2000, 1
GTString 1,2,100,60,50,24,"hello",0,32,"olleh"
GTButton 1,3,100,90,50,24,"Toogle",$2000
AttachGTList 1,1

*gad2.Gadget = GTGadPtr(1,2)
*gad1.Gadget = GTGadPtr(1,1)

Repeat

  ev.l = Event
  If ev
  WLocate 0,18 : Print "event: ", Hex$(ev), " ",Hex$(*win)," ",Hex$(*gad)
  EndIf
  Select ev
  Case #IDCMP_GADGETUP

    Select GadgetHit
    Case 1
      WLocate 0,30 : Print "SHAPE HIT"
      BeepScreen 1: VWait 1
    Case 3
      Select GTStatus(1,3)
      Case 1 :
        GTEnable 1,1 : GTEnable 1,2

      Case 0 :
        ;GTDisable 1,2
        GT_SetGadgetAttrsA_ *gad2,*win,0,Tags(#GA_Disabled,True)

        ;GTDisable 1,1
        GT_SetGadgetAttrsA_ *gad1,*win,0,Tags(#GA_Disabled,True)
      End Select
    End Select

    WLocate 0,0
    NPrint "string status: ", GTGetAttrs(1,2,#GA_Disabled), " shape status: ", GTGetAttrs(1,1,#GA_Disabled)
  Default
    WLocate 0, 30 : Print "                "
  End Select

Until ev = #IDCMP_CLOSEWINDOW
End
FraBro1 commented 8 months ago

thanks for trying.

i did try GTSetGadgetAttrsA myself but my Amigalibs.res in FSUAE (in BlitzBasic, where the same happens,) has no #GA_Disable/#GA_Enable included.

It was for someone else, but i thought i ask the expert...

FraBro1 commented 8 months ago

the GTShape gets drawn correctly disabled, if it was initialised as disabled at time of creation.

honitos commented 8 months ago

If you could organize a working example that uses the gadtools.library functions, I could inspect the asmcode of the blitzlib what is different there.

The example could be in Blitzbasic or C.

I guess it is the way the gadget is created by the blitzlib.