English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 17 April 2019, 11:32   #1
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 42
Posts: 141
Doesn't Blitz2 recognize IDCMP_IDCMPUPDATE event?

Hi,
below you can find a short program that opens a window and draws one boopsi gadget inside.
After pressing the gadget a black rectangle should be drawn in the window to indicate that IDCMPUPDATE is working (btw. another rectangle is also drawn when a keyboard is pressed - just to be sure anything is working).

Unfortunately there is no reaction when I press that gadget. Is there something missing in that code?
Thanks
Code:
DEFTYPE.IntuitionBase *ibase
DEFTYPE.Screen        *scr
DEFTYPE.Window        *win
DEFTYPE.DrawInfo      *di
DEFTYPE.Image         *upimage
DEFTYPE.Gadget        *upbutton
DEFTYPE.IntuiMessage  *msg

DEFTYPE.l idcmp
DEFTYPE.l suc
DEFTYPE.w w
DEFTYPE.w h
DEFTYPE.b done

Dim tags.TagItem(20)



;find WB
;---------------------
*ibase  =IntuitionBase
lock.l  =LockIBase_(0)
*scr    =*ibase\FirstScreen
While *scr
  If (*scr\Flags)&#SCREENTYPE=#WBENCHSCREEN
    Pop While
    Goto jump_00
  EndIf
  *scr=*scr\NextScreen
Wend
jump_00:
UnlockIBase_(lock)
*di =GetScreenDrawInfo_(*scr)


;arrow up image
;-----------------------
tags(0)\ti_Tag =#SYSIA_Which,    #UPIMAGE
tags(1)\ti_Tag =#SYSIA_Size,     #SYSISIZE_HIRES
tags(2)\ti_Tag =#SYSIA_DrawInfo, *di
tags(3)\ti_Tag =#TAG_DONE,       0

*upimage=NewObjectA_(0,"sysiclass",&tags(0))
suc=GetAttr_(#IA_Width,*upimage,&w)
suc=GetAttr_(#IA_Height,*upimage,&h)


;boopsi gadget
;-------------------------------------
tags(0)\ti_Tag  = #GA_Previous,    0
tags(1)\ti_Tag  = #GA_ID,          112
tags(2)\ti_Tag  = #GA_Left,        30
tags(3)\ti_Tag  = #GA_Top,         30
tags(4)\ti_Tag  = #GA_Width,       w
tags(5)\ti_Tag  = #GA_Height,      h
tags(6)\ti_Tag  = #GA_DrawInfo,    *di
tags(7)\ti_Tag  = #GA_GZZGadget,   False
tags(8)\ti_Tag  = #GA_Image,       *upimage
tags(9)\ti_Tag  = #ICA_TARGET,     #ICTARGET_IDCMP
tags(10)\ti_Tag = #TAG_DONE,       0

*upbutton=NewObjectA_(0,"buttongclass",&tags(0))


;and the window
;-------------
idcmp=#IDCMP_CLOSEWINDOW|#IDCMP_RAWKEY|#IDCMP_IDCMPUPDATE
title.s="test"

tags(0)\ti_Tag =#WA_Left,     *scr\WBorLeft
tags(1)\ti_Tag =#WA_Top,      *scr\BarHeight+1
tags(2)\ti_Tag =#WA_Width,    *scr\Width/4
tags(3)\ti_Tag =#WA_Height,   *scr\Height/2
tags(4)\ti_Tag =#WA_PubScreen,*scr
tags(5)\ti_Tag =#WA_Title,    &title.s
tags(6)\ti_Tag =#WA_Activate, True
tags(7)\ti_Tag =#WA_Flags,    #WFLG_DRAGBAR|#WFLG_CLOSEGADGET
tags(8)\ti_Tag =#WA_IDCMP,    idcmp
tags(9)\ti_Tag =#WA_Gadgets,  *upbutton
tags(10)\ti_Tag=#TAG_DONE,    0

*win=OpenWindowTagList_(0,&tags(0))
suc=SetFont_(*win\RPort,*scr\RastPort\Font)



Repeat
  WaitPort_(*win\UserPort)
  *msg=GetMsg_(*win\UserPort)
  While *msg
    Select *msg\Class
      Case #IDCMP_IDCMPUPDATE
        SetAPen_ *win\RPort,1
        RectFill_ *win\RPort,12,112,12,32
      Case #IDCMP_RAWKEY
        SetAPen_ *win\RPort,1+Int(Rnd(3))
        RectFill_ *win\RPort,12,70,23,90
      Case #IDCMP_CLOSEWINDOW
        done=True
    End Select
    ReplyMsg_(*msg)
    *msg=GetMsg_(*win\UserPort)
  Wend
Until done
CloseWindow_(*win)
DisposeObject_(*upimage)
DisposeObject_(*upbutton)
End
peceha is offline  
Old 17 April 2019, 15:45   #2
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,947
Since you're not using Blitz's own window and event handling commands, it can't really be a case if not recognising it - all the flags are simply constants, and you'll get a compile-time error if they're not defined. But even the built-in commands tend to simply pass through all constants and messages so it's strange that it doesn't work. Perhaps the gadget simply doesn't report it? Or, perhaps the IDCMPUPDATE is only triggered on a GADGET_DOWN or GADGET_UP event? In that case, those flags aren't enabled so the whole chain might be getting swallowed before you get a chance to see it.
Daedalus is offline  
Old 17 April 2019, 20:22   #3
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 42
Posts: 141
If I understand it correctly, boopsi objects/gadgets do not use IDCMP_GADGETUP/DOWN events and they notify the window by sending IDCM_IDCMPUPDATE signal.
The code above works when written in C but not when in Blitz.

I just compiled that code in AmiBlitz and .... the same.
So something must be missing.. but what?

Thanks

Last edited by peceha; 17 April 2019 at 20:32.
peceha is offline  
Old 18 April 2019, 12:36   #4
peceha
Registered User

peceha's Avatar
 
Join Date: Dec 2017
Location: Poland
Age: 42
Posts: 141
Looks like I found the problem.

This is taken from Amiga Docs:
Quote:
#define ICTARGET_IDCMP (~0L)
I changed my code slightly and instead of writing #ICTARGET_IDCMP I just put TRUE (which is -1)
Now my window gets an IDCMP_IDCMPUPDATE event

So, there may be a mistake in amigalibs.res.

Last edited by peceha; 18 April 2019 at 15:17.
peceha is offline  
Old 18 April 2019, 14:36   #5
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,947
Ah, that's interesting, good to know! Glad you got it sorted
Daedalus 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
Winuae doesn't recognize Doubleclick with Win7 user support.WinUAE 10 20 May 2018 22:40
A600 doesn't recognize CF-cards A500Fan support.Hardware 15 27 March 2015 01:06
iGame doesn't recognize two games... Xenon support.Apps 3 30 September 2009 18:54
Can you recognize this tune? Akira Retrogaming General Discussion 9 01 September 2009 11:43
GVP 040 Combo doesn't recognize SIMMs astuermer support.Hardware 9 28 May 2005 18:38

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 21:22.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.06379 seconds with 15 queries