Skip navigation
Currently Being Moderated

Setting ToolBar button label text

Aug 16, 2012 9:25 AM

Does anyone know why this code isn't setting a label next to my button?  I would like to create a button with an image and a text label on the right side of the button.  The button is displaying with my image, but the label isn't showing up.


ACCB1 ASBool ACCB2 PluginInit ()



    AVToolBar toolBar = AVAppGetToolBar ();

    AVToolButton toolButton, toolsSeparator;


    // Set up our toolbutton

    toolsSeparator = AVToolBarGetButtonByName (toolBar, ASAtomFromString("endToolsGroup"));

    toolButton = AVToolButtonNew (ASAtomFromString("ADBE:LFAcroPlugIn"), GetButtonIcon(), true, false); 


    // Toolbutton internal by default.

    //AVToolButtonSetExternal (toolButton, TOOLBUTTON_EXTERNAL);


    AVToolBarAddButton(toolBar, toolButton, true, toolsSeparator);

    AVToolButtonSetExecuteProc (toolButton,

        ASCallbackCreateProto(AVExecuteProc, &LFAcroPlugInCommand), NULL);

    AVToolButtonSetComputeEnabledProc (toolButton,

        ASCallbackCreateProto(AVComputeEnabledProc, &LFAcroPlugInIsEnabled), NULL);

    AVToolButtonSetHelpText (toolButton, "Save");


    //Create Label for Save Button

    ASText tmpText = ASTextNew();

    ASTextSetPDText(tmpText, "Save");

    ASConstText labelText = tmpText;


    AVToolButtonSetLabelText(toolButton, labelText, kAVButtonPriorityOnNormal);


    return true;


  • Currently Being Moderated
    Aug 16, 2012 1:04 PM   in reply to lfdevjared

    What version of Acrobat?

    Mark as:
  • Currently Being Moderated
    Feb 14, 2013 3:30 AM   in reply to lfdevjared

    Can you please share GetButtonIcon() source code? I'm having difficulty in adding button. Tried a lot, but couldnt get through.

    Mark as:
  • Currently Being Moderated
    Apr 15, 2013 5:31 PM   in reply to lfdevjared

    If you add the label BEFORE you add it to the toolbar it works. I've tested this using the Acrobat X SDK in both Reader X and 11.


    So basically, move this line to AFTER you set the label.


    AVToolBarAddButton(toolBar, toolButton, true, toolsSeparator);

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points