Jump to content

Help with UniCombobox in ClientSide


cristianotestai

Recommended Posts

Hello!

 

I did a simple test case attached with 1 UniComboBox, 1 UniEdit and 1 UniImage, where in the change of the selected item in the Combo, it makes simple changes in the properties of the components.

 

How to accomplish this in clientside? Which UniComboBox event to use?

 

Thank you for your help.

ComboBox.rar

Link to comment
Share on other sites

Hi,

 

UniComboBox -> ClientEvents -> ExtEvents -> function change :

function change(sender, newValue, oldValue, eOpts)
{


}

Best regards,

 
Hi Delphi Developer,
 
I tried to use the change function as you indicated and just to test:
 
function change(sender, newValue, oldValue, eOpts)

{

  fmTaskEdit.edRegName.focus();

}
 
But not work. Besides setting the focus i also need when changing the item in the ComboBox in clientside script:
 
to set ReadOnly property of a UniEdit;
to set Visible property of a UniImage;
to set Hint property of a UniImage;
 
Could you help?
 
Thanks!
Link to comment
Share on other sites

Hi,

 

I just tried to convert Delphi code to JS code, try  this:

function change(sender, newValue, oldValue, eOpts)
{
    var me = sender;
    var indx = me.store.indexOf(me.findRecord(me.valueField || me.displayField, me.getValue()));

    MainForm.UniEdit1.setReadOnly(indx == 0);
    MainForm.UniImage1.setVisible(!MainForm.UniEdit1.readOnly);

    switch (indx) {
        case 1:
            MainForm.UniImage1.setElProp("title", me.getValue(), 2);
            break;

        case 2:
            MainForm.UniImage1.setElProp("title", me.getValue(), 2);
    };

    if (MainForm.UniEdit1.readOnly == false) {
        Ext.defer(function() {
            MainForm.UniEdit1.focus();
        }, 100);
    };

}

Best regards,

Link to comment
Share on other sites

Hi,

 

I just tried to convert Delphi code to JS code, try  this:

function change(sender, newValue, oldValue, eOpts)
{
    var me = sender;
    var indx = me.store.indexOf(me.findRecord(me.valueField || me.displayField, me.getValue()));

    MainForm.UniEdit1.setReadOnly(indx == 0);
    MainForm.UniImage1.setVisible(!MainForm.UniEdit1.readOnly);

    switch (indx) {
        case 1:
            MainForm.UniImage1.setElProp("title", me.getValue(), 2);
            break;

        case 2:
            MainForm.UniImage1.setElProp("title", me.getValue(), 2);
    };

    if (MainForm.UniEdit1.readOnly == false) {
        Ext.defer(function() {
            MainForm.UniEdit1.focus();
        }, 100);
    };

}

Best regards,

 

 Thanks Delphi Developer!  This work!

 

 Best Regards,

 

 Cristiano

Link to comment
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...