Dietrich Streifert schrieb:
Sebastian Werner schrieb:

Yes, each widget has the following methods (as you can see in the automatically generated reference):

setStyleProperty
setHtmlProperty
setHtmlAttribute

I would suggest to use setHtmlProperty("name", "foo1"), but I think the QxTextArea also has a property "name" which means you should be able to use setName("foo1") then. Which is a bit more real qooxdoo style.


Yes I found that and I managed to set the name attribute by calling :

   setHtmlAttribute('name','whatever');

So as I see the difference between setHtmlAttribute and setHtmlProperty is that setHtmlAttribute sets existing Attributes whereas setHtmlProperty creates a new Attribute in
the DOM node. Is this correct?

No. Attributes mean real attributes. Not all things you define as an attribute in HTML are in JavaScript arributes, too. You can choose between setHtmlProperty, which does something like yourNode.yourProperty = yourValue, and setHtmlAttribute, which does something like yourNode.setAttribute(yourProperty, yourValue);

This is a bit hard with the first steps. The most time I think you can simply use setHtmlProperty, because this is often more stable in the major browsers.


There is remaining one problem with focusing and text selection in the textarea object. I'll start another thread on this.

Here is the code which I use now to create a modal Dialog with a textarea field in it:

   <script type="text/javascript" language="JavaScript">
       function getFormByName (formName) {
           if (!document.all)
               return document[formName];
           else
               for (var f = 0; f < document.forms.length; f++)
                   if (document.forms[f].name == formName)
                       return document.forms[f];
           return null;
       }
              function getFormFieldByName (formName, fieldName) {
           if (!document.all) {
               try {
                   return document[formName][fieldName];
               }
               catch(er) { return null; }
           }
           else { // IE has a bug not adding dynamically created field
// as named properties so we loop through the elements array
               var form = getFormByName(formName);
               for (var e = 0; e < form.elements.length; e++)
                   if (form.elements[e].name == fieldName)
                       return form.elements[e];
           }
           return null;
} window.application.main = function() {

           var d = this.getClientWindow().getDocument();
                      QxPopup.prototype._shouldBecomeCreated = function() {
             return true;
           };

           dialog = new QxWindow('Frage Editieren', 'icons/16/edit.png');
           dialog.setSpace(300, 400, 100, 300);
           dialog.setModal(true);
           dialog.setShowClose(false);

var qxf = new QxForm(); qxf.setHtmlAttribute('name','editform'); var qxt = new QxTextArea(); qxt.setHtmlAttribute('name','thetext'); var qxh = new QxTextField(); qxh.setHtmlAttribute('name','id'); qxh.setHtmlAttribute('type','hidden');
                     qxf.add(qxt,qxh);
           dialog.add(qxf);
var btnOK = new QxButton('OK', 'icons/16/button_ok.png'); var btnCancel = new QxButton('Abbruch', 'icons/16/button_cancel.png');

           btnOK.set({ bottom : 10, right : 10 });
           btnCancel.set({ bottom : 10, left : 10 });
                      btnCancel.addEventListener('click', function(e) {
               dialog.close();
           });
           btnOK.addEventListener('click', function(e) {
               alert(getFormFieldByName('editform','thetext').value);
               dialog.close();
           });
                      dialog.add(btnOK, btnCancel);
           d.add(dialog);
                  }
              </script>




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to