Custom draw items from drop-down list

Hi all

I'm working on the CS6 plugins portage CC, 2014.

A question, I am puzzled, is that with CS6, I'm able to customize the drawing behavior of elements within a drop-down list, by substituting the methods in 'IOwnderDrawItem', which was grouped on "kDropDownListWidgetBoss".

But it seems that with the SDK of CC,

-The "IOwnerDrawItem" is aggregated is "kDropDownListWidgetBoss", and

-The "IOwnerDrawItem" no longer has the "DrawItem" method

The porting guide does not seem to provide a solution to this. I am looking for help on how I can achieve this with CC.

Thank you very much.

-Jeff

I think I found the solution/work around for this. Just display back here as I do see there are a lot of viewers and hope that this would help others who run in the same question.

Basically, I think that the previous SDK allowed "DrawItem" that essentially provided a quick shortcut to allow a custom drawing of elements within a drop-down list content of the string. Inside the implementation of the method, you would need to enter the contents of the string of the item to retrieve more specific domain based on the chain, and point out things.

And with the SDK of CC, it seems he wants to discourage this shortcut and promote encapsulation from the drop-down list items. So now, you declare a type of custom widget (extension "kBaseWidgetBoss"), which includes a custom implementation of 'IID_ICONTROLVIEW', which makes the custom drawing. And during the filling of the drop-down list, you will need to create instances of the custom widget type, then put them in the drop-down list list dropdown controller via.

And for the drop-down list, you can declare your custom type by the extension "kOwnerDrawDDListWidgetBoss", where you can then provide a custom implementation of "IID_IOWNERDRAWITEM", to reach the specific item measure needs.

I think that it is good intention and cleaner, just I wanted there was more clear instructions in the porting guide.

-Jeff

Tags: InDesign

Similar Questions

  • How to change values from drop-down list in several fields simultaneously

    I have a 50-page form that contains a multitude of areas.  One of the fields from drop-down list is repeated throughout the form.  The values in the drop-down list options must be the same for all fields of form drop-down list.  These fields are not copies.  I need to make them individually selectable with touching other areas.

    The problem is, I often have to update the values in these fields... and there are dozens of them.

    Is there a way to store the list in the document and have all dropdowns access from this central location?

    You can do quite easily with a script. For example:

    var aList is ['Alaska', 'Washington', "Oregon", "Idaho", "Montana"];.

    getField("dropdown1").setItems (aList);

    getField("dropdown2").setItems (aList);

    Add any other dropdowns here

    You can store this code in a JavaScript function at the level of the document and update it and then call it whenever you need to update the drop-down lists. If you need to include the value of exports for the elements, you need to change the table suruneliste to an array of arrays, something like:

    aList var = [['Alaska', 'AK'] ['Washington', 'WA'], ['Oregon', 'GOLD'], ['Idaho', 'ID'], ['Montana', 'MT']];

  • How to have a single list of items in drop-down lists separated?

    Software: Acrobat X (10) pro Windows

    I want to create a form pdf in which drop all lists are filled with the same list of items to choose from. If I use the same field name for all drop-down lists, the selected item in a menu drop-down is automatically selected for all lists. This is not what I want. I want to be able to select an element that is unique and different in each drop-down list. I could of course keep lists of items for each field (using the separated field names) but a waste of time!... especially since the field lists must be updated separately. There must be a better way to do it.

    Any idea how this could be done? Thank you.

    Here's a sample script that defines a list of items in a table first and uses it to update a number of drop-down menus, name dd1... dd10:

    Fill a table with list items

    var aItems = ["--select a State--", "Alaska", "Hawaii", "Washington", "Oregon", "Idaho", "Montana", "Wyoming", "Nevada", "Colorado", "Arizona", "New Mexico"];

    Browse the menus...

    for (var i = 1; i)< 11;="" i="" +="1)">

    .. .and set the list items

    getField ("dd" + i) .setItems (aItems);

    }

    That's all there is to it. This can be run from the mouse event to the top of a temporary button you create, (Ctrl + J) interactive JavaScript console, etc.

    More information on setItems: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.752.html

  • Selections from drop-down list in the text box is not saved when PDF is saved/sent

    I have a drop-down selection list and items can be added from the drop-down list in a textbox as multiple items. (this work all fine)

    When I send the form as a PDF and then all the other field values is saved, except the values entered into the text selected in the dropdownlist control box.

    How can I get these values to be saved in the PDF file so that these values disappear.

    Thank you so much for everything tips to get this working so that when the form is sent by e-mail the selected values go with the form

    .. run only in the file > Properties > tab by default , that the changes of Script preserve is set to Automatic.

    Niall

  • Reading data from drop-down list

    Hello
    We need to capture the value selected in the dropdown, EditBox and Multiselect and write this additional reference value [see this avlue selected with report on export]. I am able to read the value of the editing area and he rewrite in the text file, but I am not able to read the value drop-down list.
    Could someone share the script to read the value drop-down list.

    -Amit

    Hey Amit,

    You have to write javascript that passes by the dashboard page and locates the combo box that is the SELECT tag.

    Each SELECT tag has an event called onChange. You want to set this event to your custom function that writes the selected value down to a text file.

    Your function would probably do something like this:

    var writeValueOut = function () {}
    leader. Write (this.options\[this.selectedIndex\].value);
    }

    Good luck!

    UPDATE: I always forget that I got all my media!

    -Joe

    Published by: Joe Bertram on December 17, 2009 09:13

  • Items in drop-down list box

    I'll put up a form to fill out using adobe.  I'm trying to set a list box dropdown values/elements based on several fields in the form.  For example, the first part of the form will have a user list employee names.  I try to have the seized names appear as options in the drop-down list box.  Any suggestions would be greatly appreciated.

    This piece of code will get the values of the fields name1, name2, etc.. :

    Value1 = this.getField("Name1").value;

    value2 = this.getField("Name2").value;

    You can then use these variables (value1, value2, etc.) to set the values of the elements of list box.

  • Custom image drop-down list appears not appropriate on Blackberry 9000 Simulator

    Hello

    I created the custom in my code drop-down list. my code works fine for other simulators.

    But when I tried to run on Blackberry 9000 Simulator from the drop-down list not shown correct image he cuts half the size of the image.

    I check my code, I did not manually height for the drop-down list.

    Please tell me why image appears not appropriate Simulator 9000.

    Welcome to the forums.

    I'm guessing that you don't know how to use the insert of Code button.  If you look at the top of the editing window, you will see a number of options for formatting such as police.  Look to the right and there are two buttons, one is used to insert the code.  Hover over the buttons and you will see a description.  Press the button insert the Code, add your code and you will see something like the following:

        public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
            Bitmap bitmap = Bitmap.getBitmapResource(arrowBitmapName);
            int fontWidth = getFont().getAdvance(text);
            int width = Display.getWidth() ;
            int height = list.getRowHeight();
            g.setColor(Color.BLACK); g.setFont(fontPlain);
            g.drawBitmap(0,0, bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);
            g.drawText(text, 3, y-drptextHeight, 0, w);
        }
    

    I think it's the routine that you use to draw each line of your drop...

    I recommend that move you as much code as you can out of this method.  It's called very often.  Creating a Butmap here, which is an expensive operation, is not a good idea, especially when the Bitmap image in reality does not change.  So create once and use it in the drawListRow.

    Also use the parameters that are passed.  The width you have to paint is given in the parameter, and perhaps not the same as the actual display width.

    In any case, this code draws the Bitmap to (0, 0).  I susspect should be at (0, y).  This could explain why it is not drawn correctly.  You seem to have a similar problem with the text.

    The drawListRow is assigned a value of 'y' and should paint from y to y + listField.getRowHeight ().  But in fact drawListRow has access to the area of the entire painting, so can do too much else.  You must code your method correctly to get good results in your list.

    Hope this helps, if not, please post your code so we can actually read.  In fact, as I say to others, do not post your real code.  Create a simple example that we can run illustrating your problem.  Then everything can run your example and see the problem.  Never stick all your code.  People are put off by the number of lines of code.

  • ADD ITEMS TO THE LIST DROP-DOWN LIST TO A TEXT FIELD (USER ENTERS THE ITEM) AND ALSO RELATED TO VALUE

    Untitled.jpg

    I have WANTED to ADD of ELEMENTS from the list drop-DOWN OF THE AREA of TEXT (the ELEMENT NAME) WHERE the USER BETWEEN of THE DESCRIPTION of POINT

    AND RELATED value SHOULD ALSO BE ADDED to THE SAME ELEMENT.

    LIKEWISE REMOVE ITEMS IN THE DROP-DOWN LIST

    PLEASE GIVE SHAPE TO SAMPLE OR JAVASCRIPT FOR THE ABOVE SCENARIO...

    INDEED USEFUL FOR MY PROJECT PLEASE SEND PDF FORM

    Hi Praveen,

    You can add items to the list in a specific order, which would be to load the elements in an array, sorting and then load in the dropdown list drop-down list.  This would be in the click event of the button Add.

    Create a table to hold all the list items, table drop-down list contains objects with a property 'displayItem' and 'value '.

    dropDownItems var = [];

    Add the new

    dropDownItems.push ({displayItem: ItemName.rawValue, value: BoundValue.rawValue});

    Add existing ones

    for (var i = 0; i)< dropdownlist1.length;="">

    {

    dropDownItems.push ({displayItem: DropDownList1.getDisplayItem (i), value: DropDownList1.getSaveItem (i)})

    }

    Sort by ascending order of displayed text

    () dropDownItems.sort

    function (a, b)

    {

    If (a.displayItem< b.displayitem)="" return="">

    If (a.displayItem > b.displayItem) return 1;

    return 0;

    });

    clear all items

    DropDownList1.clearItems ();

    load the sorted items

    for (var i = 0; i)< dropdownitems.length;="">

    {

    var dropDownItem = [i] dropDownItems;

    DropDownList1.addItem (dropDownItem.displayItem, dropDownItem.value);

    }

    clear the fields of the source

    ItemName.rawValue = null;

    BoundValue.rawValue = null;

    I added a button 'Add' sorted in my sample https://workspaces.acrobat.com/?d=OwysfJa-Q3HhPtFlgRb62g

    Concerning

    Bruce

  • Try to get the value of exports from the drop-down list box

    Using the "strikes a custom Script" for a drop-down list box:

    This works, but gives the current face value


    If (event.willCommit)
    {
    App.Alert (Event.value);
    }

    This works, but returns the previous export value


    If (event.willCommit)
    {
    App.Alert (Event.Target.value);
    }

    What I need is clicked on the current export value items as soon as we clicked.

    What I am doing wrong?

    Note that it returns nothing if event.willCommit is true, but it returns the value of the export, if it's false.

  • populating drop-down list from multiple instances of the subform

    I have a drop-down list xfa.form.assessment.Questions.Questionset.Questiondetail.FIBdetail.qObjlist

    That I want to fill it with the text of all instances of the xfa.form.assessment.Objectives.objectivesdetail.objective text field.

    The user determines how many instances of xfa.form.assessment.Objectives.objectivesdetail will take place.

    How can I write the addItem for the drop-down list to capture data from all instances of xfa.form.assessment.Objectives.objectivesdetail?

    Hello

    I tried to have the area of the exit of the texfield goal fill in the items in drop-down list, but he doesn't like it if 'white' filling has been hidden. So I code the following javascript in the input of the "White Fill" dropdown list event instead. This retrospective look at the objectives and loops through them:

    this.clearItems();
    this.rawValue = null; 
    
    var nCount = Objectives.objectivesdetail.instanceManager.count;
    console.println("nCount: " + nCount); 
    
    for (var i=0; i<=nCount; i++)
    {
         var vFld = xfa.resolveNode("Objectives.objectivesdetail[" + i + "]");
         var vObj = vFld.objective.rawValue;
         Questions.Questionset.Questiondetail.FIBdetail.qObjlist.addItem(vObj);
    }
    
    There are some potential problems with the form, that appear in the javascript console. You should check these.
    I hope this helps.
    Niall
  • A drop-down list box, two text boxes

    Hi all, I feel a bit silly to ask what she should be very simple, right? I have the a combo, the solution box a text down pat. For example when the user select name of the staff member in the drop down menu, it fills the phone number of this person in Textbox1.

    I would like to add to this so that when a user selects (and here I use false details) "Bob," he filled before his phone number in Textbox1 and "[email protected]" in Textbox2 simultaneously. Simply impossible to find the solution of anywhere.

    So far, I have used the code next (on the net) in the scripts of strike of the custom from the drop-down list box, but how I lay on it?

    (function () {}

    Do nothing if it is committed
    If (event.willCommit) return;

    Set up a table to hold the various paragraphs of the text
    var aQuotes = [];

    Fill the table with the text of paragraph
    aQuotes [0] = "bob phone"
    aQuotes [1] = 'sarah phone'
    aQuotes [2] = "phone linda".
    aQuotes [3] = "phone jerry."
    aQuotes [4] = "phone of mary".
    aQuotes [5] = 'phone jessie. "

    Get the selected item, which is the value of exports of the selected drop-down list box item
    var point = event.changeEx

    Display the text corresponding to the selected item in the text field
    getField("ITC_Phone").value is aQuotes [point];.

    })();

    Bravo guys.

    Like this:

    Custom script from typo to the drop-down list box (dropdown)

    (function () {}

    Do nothing if it is committed

    If (event.willCommit) return;

    Set up a table to hold the various paragraphs of the text

    var aQuotes = [];

    Complete the tables table of telephone and e-mail addresses

    aQuotes [0] = ['phone of bob', "[email protected]" ""];

    aQuotes [1] = ["sarah phone", "[email protected]" ""];

    aQuotes [2] = ["phone linda", "[email protected]" ""];

    aQuotes [3] = ['phone jerry', "[email protected]" ""];

    aQuotes [4] = ['phone mary', "[email protected]" ""];

    aQuotes [5] = ["phone jessie", "[email protected]" ""];

    Get the selected item, which is the value of exports of the selected drop-down list box item

    var point = event.changeEx;

    Display the text corresponding to the selected item in the text field

    getField("ITC_Phone").value = aQuotes [item] [0];

    getField("ITC_Email").value = aQuotes [item] [1];

    })();

    This code assumes that the value of exports of the items in drop-down list box is 0, 1, 2, 3...

    If there is much more that the aQuotes table should really be defiined in a JavaScript file at the level of the document if you are concerned about performance and maintainability.

  • Using fields show/hide with drop-down lists

    The following code stores and displays the data in a field of view based on what the user selects and it works fine, but I'm not sure how to incorporate additional content in this context.

    Form1. #subform [0]. indPaymentOptions::change - (JavaScript, client)

    Switch - test for the "selected" text, if so, display "display" text

    switch (this.boundItem (xfa.event.newText)) {}

    case "donation/Contribution:

    var display = "Restricted use, usually the student fundraisers. May be a political entity neither does not endorse a political goal. Raised funds donations require a copy of the filing. < span style =------"color: #FF0000;" make-style: italic; ------"> must be attributed to Unassigned funds and senior officer of the authority." </span > ';

    XmlToShow = XmlStart + screen + XmlEnd;

    xfa.resolveNode ("form1. #subform. Display_Field_Pay_Types'). value.exData.loadXML (XmlToShow, true);

    taxReportable.rawValue = 'Y ';

    AccountCodesDynamic.rawValue = "001285;

    break;

    case "Membership":

    var display = 'membership sponsored University must be directly related to the responsibilities of the proposed Member University. Get institutional investors rather that individual memberships to allow the participation of several or another employed. Membership must use a UCSC address for administrative audit. « ;

    XmlToShow = XmlStart + screen + XmlEnd;

    xfa.resolveNode ("form1. #subform. Display_Field_Pay_Types'). value.exData.loadXML (XmlToShow, true);

    taxReportable.rawValue = 'Y ';

    AccountCodesDynamic.rawValue = "001200, \n001210;

    break;

    by default:

    VendPaymentOptions.rawValue = "Please select an option from the drop-down menu"Select type"above."

    taxReportable.rawValue = "";

    break;

    }

    I'm going to show a hidden field, once one of the items in drop-down list is selected with an if statement then. I tried to put the code below in the code above, but it does not work. I am familiar with livescript event management system, so I'm not too sure where the if then statement must be submitted. Should it be set in the * click the section? Or the initialze section? If someone could shine some light on what to do here it would be great.

    If (xfa.resolveNode("form1.#subform.indPaymentOptions").rawValue == 1) {}

    xfa.resolveNode("form1.#subform.textfield1").presence = "visible";

    }

    else {}

    xfa.resolveNode("form1.#subform.textfield1").presence = 'hidden ';

    }

    My example display only text. When you view the drop down from the window of the object, click the link tab. If specify the item values is checked, then boundItem will return what is in the value column during the passage of what is in the text column. If you have added an additional element in the list without adding an item of value, maybe that's your problem. In my example, if you check the box, it will be 1, 2, 3 in the value column. If you then in the code, you have added the this.boundItem part, case sections will have to be changed from 'TextField1' to '1' and the same for the 2 and 3.

  • Not drop-down list values in the XML that is generated after completing the form

    Hello

    I have a form that has a drop-down menus of the filling of an XML file, the items in drop-down list to a text and value associated with it.

    The problem is when I generate the XML of the form value labels are coming in instead of the text in the drop-down list.

    Pls help. How can I get the text of the value of the dropdown list selected in the XML file?

    Thank you

    Ludovic

    Hello

    I would recommend going to the object > linking the palette and deselecting 'specify values ". In this way, the display values will be included in the XML, as the display value will be the same as the .rawValue from the drop-down list.

    However, this means that any script that references the drop down menus will use the values to display for the items and not the previous related values.

    Hope that helps,

    Niall

  • Script of condition in the drop-down list

    If the drop down menu 'A' is not, and the 'B' drop is

    also no. 'C' becomes visible.

    I need help with a script for this all I can get to is:

    If

    (xfa.event.newText == 'Yes') { }

    Yes.presence

    = "visible."

    }

    else {

    Yes.presence

    = 'invisible '.

    }

    and it does not work for this instance.

    First of all, put values on the items in drop-down list in the 'Binding' palette 'subject: ' tab

    As:

    Yes bound value = 1

    No has a bound value = 0.

    Then,

    Update on the event 'exit' on the two drop-down lists, then choose 'JavaScript' for script language:

    //////////////////////////////

    If (this.rawValue == "1" & B.rawValue == '1')

    {

    C.Presence = "visible";

    }

    on the other

    {

    C.Presence = "invisible";

    }

    //////////////////////////////

    change the first line of refenence A.rawValue when you add this script in the drop-down list box B.

    That should do it.

    Good luck

    Stephen

  • Impossible to delete previously selected items from the drop-down lists at the click of the button Reset on a page of the screen.

    Hello

    I'm unable to clear previously selected items from the drop-down lists at the click of the button Reset on a page of the screen. The code I did to clear the previous value when the click on the button Reset is as below.

    {} public void onReinitialize (ActionEvent actionEvent)

    System.out.println ("onReinitialize is called ::");

    UIComponent uiComp = actionEvent.getComponent ();

    If (uiComp is nothing)

    {

    otherwise we use the button that we linked to that bean

    uiComp = getButtonResetByBean ();

    _logger.info ("reset fields: buttonID =" + uiComp.getId ());

    }

    on the other

    {

    _logger.info ("reset fields: CompID =" + uiComp.getId ());

    }

    Pass the component inside the uniforms, UIXForm, UIXSubform, UIXRegion, UIXPopup, RichCarousel

    or RichPanelCollection that contains the components to reset

    getTextIDLOV () .setValue (null);

    ResetUtils.reset (uiComp);

    }

    ---

    Using this code Iam able to clear the entrance to the text box but can not clear previously selected items from the drop-down lists when the reset button is clicked

    Can anyone please help on this issue.

    It's simple, you can set GenerateIsNullClauseForBindVars = "false" in the viewCriteria who created in EmployeeView

    After doing that it will fill the list of employees only after the Department selection

    Again check the enclosed application

    Ashish

Maybe you are looking for