Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
169 user(s) are online (125 user(s) are browsing Forums)

Members: 2
Guests: 167

BCP, joerg, more...

Headlines

 
  Register To Post  

Any speedbar.gadget experts?
Amigans Defender
Amigans Defender


See User information
In my event loop I have something like this triggered on speedbar GADGETUP events:

GetAttr(SPEEDBAR_SelectedNodegadget, (ULONG *)&node);
printf("%lx\n"node); /* often gives 3e8 */
GetSpeedButtonNodeAttrs(nodeSBNA_UserData, (ULONG *)&storageTAG_DONE); /* crash */
printf("%s\n"storage);


If this is the wrong way (as it doesn't seem to work), can somebody tell me the correct way to get the SpeedButtonNode pointer for the button that was just clicked on?

Go to top
Re: Any speedbar.gadget experts?
Home away from home
Home away from home


See User information
node NULL;
if(
GetAttr(SPEEDBAR_SelectedNodegadget, (ULONG *)&node))
{
    if(
node)
    {
        
GetSpeedButtonNodeAttrs(nodeSBNA_UserData, (ULONG *)&storageTAG_DONE)
    }
}


perhaps

Go to top
Re: Any speedbar.gadget experts?
Amigans Defender
Amigans Defender


See User information
Hmm, well that proves that it isn't getting the SPEEDBAR_SelectedNode property.

What's confusing me is that the autodoc states that SPEEDBAR_SelectedNode applies to OM_NOTIFY only. This explains why GetAttr is failing, but how do I get the info from an OM_NOTIFY attribute?

Go to top
Re: Any speedbar.gadget experts?
Just can't stay away
Just can't stay away


See User information
@Chris

In order to get OM_NOTIFY updates in your application you need to set the gadget's ICA_TARGET to ICTARGET_IDCMP so that it sends them IDCMP_IDCMPUPDATE messages to your window's UserPort and then use an IDCMP hook to catch the messages if you're using window.class.

What I would probably do instead of doing this and using SPEEDBAR_SelectedNode as it seems unreliable is probably to just put all the speedbar button nodes in an array with the speedbar button ids as indexes. In fact I've already done that in a program except it was for a slightly different reason.

Go to top
Re: Any speedbar.gadget experts?
Amigans Defender
Amigans Defender


See User information
Do you have first-hand experience of it being unreliable? If so I'll do an array as you suggest (actually I'll probably just chuck my userdata in the array instead), otherwise I have other things using ICA_TARGET so it's no hassle to do it using that method.

Go to top
Re: Any speedbar.gadget experts?
Just can't stay away
Just can't stay away


See User information
@Chris

Do I have experience with the tag? No, not really. If you already have IDCMP_IDCMPUPDATE handling then go ahead and try it.

IDCMP_IDCMPUPDATE is just something I generally try to avoid as it tends to generate a lot of messages that fill up your windows' IDCMP port and also requires installing a special IDCMP hook with window.class.

Go to top
Re: Any speedbar.gadget experts?
Amigans Defender
Amigans Defender


See User information
Yes, I know what you mean. The whole IDCMP_IDCMPUPDATE handling is... weird.

Go to top
Re: Any speedbar.gadget experts?
Just popping in
Just popping in


See User information
Well, the IDCMP_UPDATE handling isnt weird at all. It was invented for very special and rare cases of Intuition event handling, far away from simple gadget event handling.

What indeed IS weird is the fact that speedbar.gadget was taken over to OS4 completely unchanged. This gadget is a complete mess, and it is weird to manage (not to mention the handling of it. "Oversize" speedbar gadget are crude to handle for a user. I would NEVER use it. Instead I would make up my own).

In a normal case, it would have been abandoned in its current form and replaced by a gadget that is handling its internals like e.g. clicktab.gadget and relatives do.

These dont need an IDCMP_TARGET to tell what node of the gadget was clicked. Simply get the node number from a quite normal Intuition gadget message and resolve the appropriate node to get more information.

See where the problem is?

Go to top
Re: Any speedbar.gadget experts?
Home away from home
Home away from home


See User information
The only code I have that deals with speedbar is AWeb.

It used a convoluted IDCMP_UPDATE based approach which I couldn't quite work out. So I didn;t post about it. Just the more rigorous code for checking the GetAttrs results.

But if you looking aweb/window.c and aweb/event.c in the aweb source (on os4depot) there is code for handling the speedbar.

AWeb doesn't use a Reaction window for it main window though, so the code will require some changes.

search for 'userbutton' and 'speedbar' to find the right bits.


Go to top
Re: Any speedbar.gadget experts?
Amigans Defender
Amigans Defender


See User information
@whose

I've avoided speedbar.gadget up until now for the reasons you mentioned (and I was indeed expecting it to work like clicktab!). However, I wanted a dynamically-updateable button bar and speedbar seemed to fit the bill. It could do with an update though - the user interface issues definitely need fixing, and I'd like to see an option to display the image to the left of the text.

@broadblues

Thanks, I figured it out eventually. You have to use GetTagData in IDCMP_IDCMPUPDATE to retrieve the button node that was clicked.

Go to top
Re: Any speedbar.gadget experts?
Just popping in
Just popping in


See User information
@Chris

Im glad you found a way to get the node, finally. I couldnt have been of help with this, as I rejected the use of speedbar.gadget as soon as I saw the weirdness of it.

Yes, speedbar.gadget should be fixed soon, because, as you pointed out, it could be of use in many programs.

Go to top
Re: Any speedbar.gadget experts?
Home away from home
Home away from home


See User information
Chris, the latest modification you are talking are related to NetSurf right ?
If so there is a problem with latest build #688, after installed i changed the prefs according to my need (as usual) and then i click to save --> DSI

Quote:
Crash log for task "NetSurf"
Generated by GrimReaper 53.5
Crash occured in module kernel at address 0x01815F9C
Type of crash: unknown exception

Register dump:
GPR (General Purpose Registers):
0: 656E7500 47BD7EE0 00000000 0180CCA8 81000009 00000060 018184C8 020A97C4
8: 81000000 0180CCA8 FFFFFFED 01815F88 0000015C 47BF06A4 00000000 00000000
16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
24: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000


FPR (Floating Point Registers, NaN = Not a Number):
0: nan 83 52 0
4: 0 259.8 30.8 0
8: 0 4.5036e+15 259.8 1
12: 2.14748e+09 4.5036e+15 0 -5.05923e-321
16: 0 1.39067e-309 0 0
20: 0 0 0 1.61895e-319
24: 4.94066e-324 0 1.08779e-311 -4.07294e-35
28: 0 1.35808e-312 8.8275e-311 -0.234375

FPSCR (Floating Point Status and Control Register): 0x82000000


SPRs (Special Purpose Registers):
Machine State (msr) : 0x0002F030
Condition (cr) : 0x24424024
Instruction Pointer (ip) : 0x01815F9C
Xtended Exception (xer) : 0x00000005
Count (ctr) : 0x01815F88
Link (lr) : 0x01A515C8
DSI Status (dsisr) : 0x00000000
Data Address (dar) : 0x47AB0BB0



680x0 emulated registers:
DATA: 56EF1A08 0000002B 00000000 00000000 00000000 00000000 00000000 00000000
ADDR: 00000000 563FD6DA 00000000 00000000 00000000 00000000 00000000 47BD7B40
FPU0: 0 0 0 0
FPU4: 0 0 0 0



Symbol info:
Instruction pointer 0x01815F9C belongs to module "kernel" (HUNK/Kickstart)

Stack trace:
native kernel module kernel+0x00015f9c
native kernel module newlib.library.kmod+0x00006380
[desktop/tree.c:1100] NetSurf:tree_delete_node_internal()+0x224 (section 1 @ 0x71A60)
[desktop/tree.c:1129] NetSurf:tree_delete_node_internal()+0x218 (section 1 @ 0x71A54)
[desktop/tree.c:1146] NetSurf:tree_delete()+0x34 (section 1 @ 0x71BA4)
[amiga/tree.c:145] NetSurf:ami_tree_destroy()+0x1c (section 1 @ 0x32554)
[amiga/hotlist.c:74] NetSurf:ami_hotlist_free()+0x20 (section 1 @ 0x23A5C)
[amiga/gui.c:2325] NetSurf:gui_quit()+0x44 (section 1 @ 0x11FA4)
[desktop/netsurf.c:267] NetSurf:netsurf_exit()+0x28 (section 1 @ 0x62EC4)
[amiga/gui.c:892] NetSurf:main()+0x480 (section 1 @ 0x1B794)
native kernel module newlib.library.kmod+0x00002094
native kernel module newlib.library.kmod+0x00002d3c
native kernel module newlib.library.kmod+0x00002eb8
NetSurf:_start()+0x170 (section 1 @ 0x170)
native kernel module dos.library.kmod+0x0002295c
native kernel module kernel+0x0003b630
native kernel module kernel+0x0003b6b0


PPC disassembly:
01815f94: 7c842378 mr r4,r4
01815f98: 44000002 sc
*01815f9c: 4e800020 blr
01815fa0: 7c0802a6 mflr r0
01815fa4: 9421fff0 stwu r1,-16(r1)

System information:

CPU
Model: AMCC PPC440EP V1.3
CPU speed: 799 MHz
FSB speed: 133 MHz
Extensions:

Machine
Machine name: Sam440EP
Memory: 1048576 KB
Extensions: bus.pci


After reboot (yes it was a bad crash) all goes well

Go to top
Re: Any speedbar.gadget experts?
Amigans Defender
Amigans Defender


See User information
@samo79

Actually what you did when it crashed was quit. This wasn't directly related to speedbar, but it's fixed now anyway.

Go to top
Re: Any speedbar.gadget experts?
Home away from home
Home away from home


See User information
@chris

I just changed the font dimention and the tabs behaviour, then i press "save" and close the prefs window

I'm going to test the new builds...


Go to top
Re: Any speedbar.gadget experts?
Amigans Defender
Amigans Defender


See User information
@samo79

You quit NetSurf, otherwise netsurf_exit() wouldn't be in the stacktrace. Anyway, I'm not arguing about this

Go to top
Re: Any speedbar.gadget experts?
Home away from home
Home away from home


See User information
Well I guess you're right, indeed repeating the procedure was so .. i'm getting old

Go to top
Re: Any speedbar.gadget experts?
Just can't stay away
Just can't stay away


See User information
@whose

Quote:

These dont need an IDCMP_TARGET to tell what node of the gadget was clicked. Simply get the node number from a quite normal Intuition gadget message and resolve the appropriate node to get more information.


Only if you need the node pointer (the speedbutton ID is stored in the Code field of the IDCMP_GADGETUP IntuiMessage) and even then there are other ways, like simply going through the button list until you find the node with the right ID, or as I suggested earlier storing them in an ID indexed array and then retrieving the node pointer from there.

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-2023 The XOOPS Project