[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Active X control : QueryStatus( DECMD_BOLD) always sends back to me DECMDF_NOTSUPPORTED

Hi,

My problem is the following one. I try to know if I'm situated in a bold
text in a editor HTML.

For it, I try to know the value of my QueryStatus( DECMD_BOLD).

The problem is that I have only the value DECMDF_NOTSUPPORTED ( 0 ) whether
it is in bold text or not.

There is somebody who can explain me the problem, or what I didn't
understand.


Thank you in advance.

 Asra.

( Enclosed the code of my test)

_________________

public class MainHTML {

    protected static Display display;

    protected static Shell shell;

    protected OleAutomation automationHtml;

    protected OleControlSite controlSiteHtml;

    protected OleFrame oleFrameHtml;

    protected int DECMD_BOLD = 5000;

    protected int OLECMDEXECOPT_DODEFAULT = 0;

    protected  int DECMDF_ENABLED = 3;

    protected  int DECMD_LATCHED = 7;

    protected  int DECMDF_DISABLED = 1;

    protected int DECMDF_NOTSUPPORTED = 0;

    protected  int DECMDF_NINCHED = 11;

public MainHTML(){

    oleFrameHtml = new OleFrame(shell, SWT.NONE);

    controlSiteHtml = new OleControlSite(oleFrameHtml, SWT.NONE,
"DHTMLEdit.DHTMLEdit");

    controlSiteHtml.setSize(100, 100);

    controlSiteHtml.doVerb(OLE.OLEIVERB_SHOW);

    controlSiteHtml.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);

    automationHtml = new OleAutomation(controlSiteHtml);



    Button buttonb = new Button (shell, SWT.PUSH);

    buttonb.setText ("BOLD");

    buttonb.addListener (SWT.Selection, new Listener () {

        public void handleEvent (Event event) {

            int[] rgids = automationHtml.getIDsOfNames(new String[]
{"ExecCommand"});

            Variant[] rgvars = new Variant[2];

            rgvars[0] = new Variant(DECMD_BOLD);

            rgvars[1] = new Variant(OLECMDEXECOPT_DODEFAULT);

            automationHtml.invoke(rgids[0], rgvars);

            automationHtml.setProperty(rgids[0], rgvars);

            int result = controlSiteHtml.queryStatus(DECMD_BOLD);

            System.out.println ("result " + result);


         }

    });


    Button button = new Button (shell, SWT.PUSH);

    button.setText ("QueryStatus");

    button.addListener (SWT.Selection, new Listener () {

        public void handleEvent (Event event) {

            int result = controlSiteHtml.queryStatus(DECMD_BOLD);

            if ( (result == DECMDF_ENABLED ) || (result == DECMD_LATCHED))

                System.out.println("bold is enabled");

            else if (result == DECMDF_DISABLED)

                    System.out.println("bold is NOT enabled");

            else if (result == DECMDF_NOTSUPPORTED)

            System.out.println("bold is not supported");

            }

    });





}

public static void main (String [] args) {

    display = new Display ();

    shell = new Shell (display);

    RowLayout fl = new RowLayout();

    shell.setLayout(fl);

    MainHTML m = new MainHTML();

    shell.pack ();

    shell.open ();

    while (!shell.isDisposed ()) {

    if (!display.readAndDispatch ()) display.sleep ();

    }

    display.dispose ();

}

}