Jump to content

JHTMLOptionElement constructor


Recommended Posts

In W3c.HTML5 there's this definition:

	JHTMLOptionElement = class external 'HTMLOptionElement' (JHTMLElement)
	public
		disabled: Boolean;
		form: JHTMLFormElement;
		label: String;
		defaultSelected: Boolean;
		selected: Boolean;
		value: String;
		text: String;
		index: Integer;
    
    constructor Option(text: String); overload; external 'Option';
    constructor Option(text, value: String; defaultSelected: boolean = false; selected: boolean = false); overload; external 'Option';
	end;

I try to construct an object, this is what i can get through the compiler:

lSelectBox.add(JHTMLOptionElement.Option('hepp', '1'));

But this generates:

new HTMLOptionElement("hepp","1",false,false)

and the only thing i can get through runtime (chrome webkit) is this:

new Option('hepp', '1')

I'm sure i've missed something. Please advice.

 

TIA,

 

/Dany

Link to post
Share on other sites

Yes, if i change the pas name from Option to Create the correct JS constructor is generated. Thanks.

 

1½ yrs ago i asked for a writeup on constructors. I still do not understand what happens 100% and i think some of my confusion is due to "faulty" generated W3C.* headers. Stupid of me to "trust" them for learning.

 

Regards,

 

/D

Link to post
Share on other sites
  • 2 months later...

Are there any news on this. Trying to use

		procedure scrollIntoView;
		procedure scrollIntoView(top: Boolean); overload;
		procedure scrollIntoView(top: Boolean; options: JScrollOptions); overload;

from W3C.CSSOM. I can only figure out how to use the first overload :(

 

Regards,

 

/Dany

Link to post
Share on other sites

I think this core-metal-w3c classes is due overhaul.

 

The correct implementation would be:

   JHTMLOptionElement = class external 'Option' (JHTMLElement)
   // JHTMLOptionElement = class external 'HTMLOptionElement' (JHTMLElement)
	public
		disabled: Boolean;
		form: JHTMLFormElement;
		label: String;
		defaultSelected: Boolean;
		selected: Boolean;
		value: String;
		text: String;
		index: Integer;


    constructor Create(const text,value: String;
                            defaultSelected,Selected: Boolean=False); external 'Option';

    constructor Option(text: String); overload; external 'Option';
    constructor Option(text, value: String; defaultSelected: boolean = false; selected: boolean = false); overload; external 'Option';
	end;
var opt : JHTMLOptionElement;
      opt := new JHTMLOptionElement('hepp','1');
      opt := JHTMLOptionElement.Create('hepp','1');
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...