SpeedBar Separator and Images and SBNA_ButtonID

This forum is for general developer support questions.

SpeedBar Separator and Images and SBNA_ButtonID

Postby mritter0 » Fri Nov 13, 2015 3:03 am

When using an SBNA_Separator tag it does not honor the SBNA_Spacing tag. As in, it does not indent the separator to center the bar between buttons. See attached image. I am using SBNA_Spacing,6, (for the example) and the bar is not indented the 6 pixels.

Image

Being able to specify my own separator bar would be nice, too. SBNA_SeparatorImage, "mysep.png",

-------------------

I would also like to be able to specify my own disabled images like most other gadgets. Specify my own: Render, Select, Disabled images. Doing it in a BitMap would be nice:
Code: Select all
   
return(BitMapObject,
      BITMAP_SourceFile,               Render,
      BITMAP_SelectSourceFile,         Select,
      BITMAP_DisabledSourceFile,         Disabled,
      BITMAP_Screen,                  DefaultPubScreen,
      BITMAP_Precision,               PRECISION_EXACT,
      BITMAP_Masking,                  TRUE,
   TAG_DONE));


----------------------

Any news of using the SBNA_ButtonID tag? I would really like to see that come.
Workbench Explorer - A better way to browse drawers
User avatar
mritter0
 
Posts: 186
Joined: Mon Aug 25, 2014 10:41 pm
Location: Bettendorf, IA, USA

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby salass00 » Fri Nov 13, 2015 12:34 pm

mritter0 wrote:Any news of using the SBNA_ButtonID tag? I would really like to see that come.


What exactly do you need it for?

If you need > 8-bit button IDs you will have to wait for the latest version of speedbar.gadget to be released (I just added this feature).

If you just need to access the button ID of an already created speedbar button then you can use node->ln_Pri as documented in the autodoc.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 500
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby mritter0 » Fri Nov 13, 2015 10:05 pm

http://www.os4coding.net/forum/speedbar-woes

That still does not work for me. I don't get the button number in Code, I still get the speedbar ID in Code. Use SBNA_ButtonID with GetAttrs() to get which button was clicked. I am still using IDCMP_UPDATE method but not a big fan of that.

I tried not opening some of the other gadget classes and libraries that I could to see if something was interfering with speedbar, but same result.
Workbench Explorer - A better way to browse drawers
User avatar
mritter0
 
Posts: 186
Joined: Mon Aug 25, 2014 10:41 pm
Location: Bettendorf, IA, USA

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby salass00 » Sat Nov 14, 2015 10:10 am

https://dl.dropboxusercontent.com/u/265 ... dbartest.c

Just a simple program I've used to test the speedbar.gadget.

I've modified it to print out the ID of the speedbar button pressed when a WMHI_GADGETUP event is received.

Note that the code value returned from WM_HANDLEINPUT is only a speedbar button ID when the event is WMHI_GADGETUP (and the gadget released is a speedbar). For other event types it has different meanings or may even be undefined.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 500
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby salass00 » Sat Nov 14, 2015 10:22 am

mritter0 wrote:Use SBNA_ButtonID with GetAttrs() to get which button was clicked.


The SBNA_#? tags are for the AllocSpeedButtonNode(), SetSpeedButtonNodeAttrs() and GetSpeedButtonNodeAttrs() functions.

In case you're wondering SBNA is short for "SpeedButton Node Attribute".

I am still using IDCMP_UPDATE method but not a big fan of that.


The only reason to use IDCMP_IDCMPUPDATE to check for button pressed events would be if you were avoiding using window.class for some reason but still wanted to use layout.gadget for layout (AWeb does this for its browser windows for instance although I'm not sure why).
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 500
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby mritter0 » Sun Nov 15, 2015 3:34 am

The only thing I see different between the posts on both sites that might make a difference is that I use this
Code: Select all
while((Result=IIntuition->IDoMethod(Objects[OID_WINDOW],WM_HANDLEINPUT,&Code)) != WMHI_LASTMSG)

and you use AmigaLib version
Code: Select all
while ((res = DoMethod(window, WM_HANDLEINPUT, &code)) != WMHI_LASTMSG) {

When I switch to AmigaLib version I get "implicit declaration of function 'DoMethod'" warning even though I #include <clib/alib_protos.h> and use ArgString(), HotKey() and others.
If I do #define __amigaos4__ before the include I get a redefined error.

I also make my list this way
Code: Select all
   if (!(BookmarksSpeedBarList=(struct List *)IExec->AllocSysObject(ASOT_LIST,NULL)))
   {
      SAK_EasyRequest(Objects[OID_WINDOW],MainWindow,RequesterTitle,REQIMAGE_ERROR,0,SAK_LocaleString(MSG_COULD_NOT_CREATE_EXEC_LIST),SAK_LocaleString(MSG_TERMINATE));

      return(FALSE);
   }
Workbench Explorer - A better way to browse drawers
User avatar
mritter0
 
Posts: 186
Joined: Mon Aug 25, 2014 10:41 pm
Location: Bettendorf, IA, USA

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby salass00 » Sun Nov 15, 2015 9:09 am

It's impossible to tell exactly what you're doing wrong when you've only posted extremely snippets of your code where more often than not important context is missing. If possible post the code of your whole program so I can look it over and tell you what's wrong with it.

When I switch to AmigaLib version I get "implicit declaration of function 'DoMethod'" warning even though I #include <clib/alib_protos.h> and use ArgString(), HotKey() and others.
If I do #define __amigaos4__ before the include I get a redefined error.


DoMethod() is only available in amiga.lib in NDK 3.9 and earlier. For AmigaOS 4.x the function was moved to intuition.library and renamed to IDoMethod() (<inline4/intuition.h> provides a DoMethod() macro for __USE_INLINE__ however).
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 500
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby chris » Sun Nov 15, 2015 4:54 pm

mritter0 wrote:I would also like to be able to specify my own disabled images like most other gadgets. Specify my own: Render, Select, Disabled images. Doing it in a BitMap would be nice:
Code: Select all
   
return(BitMapObject,
      BITMAP_SourceFile,               Render,
      BITMAP_SelectSourceFile,         Select,
      BITMAP_DisabledSourceFile,         Disabled,
      BITMAP_Screen,                  DefaultPubScreen,
      BITMAP_Precision,               PRECISION_EXACT,
      BITMAP_Masking,                  TRUE,
   TAG_DONE));



speedbar.gadget is really badly designed, it doesn't conform to expected operation (as per other gadgets) from either a developer or user's point of view.

Whilst we're on to images, I'd like to see an option to specify how I want the text/image to be placed. Currently if you have both on a speedbar button, it's always image on top, text below. I'd like the option to have {image}{text} or {text}{image} or even (actually I don't want this, but it should be an option):
{text}
{image}

Any chance of this being added?
chris
 
Posts: 550
Joined: Sat Jun 18, 2011 12:05 pm

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby salass00 » Sun Nov 15, 2015 6:55 pm

mritter0 wrote:I would also like to be able to specify my own disabled images like most other gadgets. Specify my own: Render, Select, Disabled images. Doing it in a BitMap would be nice:


If you specify a BOOPSI image for SBNA_Image such as a bitmap.image object and it supports a selected/disabled state then they will be used when rendering the speedbar button as selected and disabled respectively.
User avatar
salass00
AmigaOS Core Developer
AmigaOS Core Developer
 
Posts: 500
Joined: Sat Jun 18, 2011 4:12 pm
Location: Finland

Re: SpeedBar Separator and Images and SBNA_ButtonID

Postby mritter0 » Mon Nov 16, 2015 2:32 am

I will try to get a more complete picture of my code together. It is spread across a couple modules.

What would fix my problem with the Code issue would be to make SPEEDBAR_Selected and SPEEDBAR_SelectedNode OM_GET so I can do this
Code: Select all
struct Node *WorkingNode;
IIntuition->GetAttrs(Objects[GAD_BOOKMARKS_SPEEDBAR],
      SPEEDBAR_SelectedNode,            &WorkingNode,
TAG_DONE);
ISpeedBar->GetSpeedButtonNodeAttrs(WorkingNode,
      SBNA_UserData,                  &Offset,
TAG_DONE);

I really want what is in SBNA_UserData, not so much the actual button number, so I can do more customization. I can make either work, though.

The above crashes.


I was hoping SBNA_ButtonID would be like LISTBROWSER_Selected
Code: Select all
IIntuition->GetAttrs(Objects[GAD_BOOKMARKS_SPEEDBAR],
      SPEEDBAR_ButtonID,            &Offset,        (or SPEEDBAR_Selected)
TAG_DONE);

Tell me which was clicked.

When creating the speedbar, SPEEDBAR_ButtonID would assign the value of the node. Or after creation to change the value.
Workbench Explorer - A better way to browse drawers
User avatar
mritter0
 
Posts: 186
Joined: Mon Aug 25, 2014 10:41 pm
Location: Bettendorf, IA, USA

Next

Return to General Developer Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron