Jump to content


Photo

TUniEdit SelStart


  • Please log in to reply
13 replies to this topic

#1 droider

droider

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 23 October 2017 - 01:31 PM

Hi!

Why UniEdit.SelStart property doesn't work from uniGUI Apps? What is the solution?


  • 0

#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 23 October 2017 - 04:32 PM

Hi,

 

Which edition and build are you using ?

 

Best regards,


  • 0

#3 droider

droider

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 23 October 2017 - 05:55 PM

FMSoft_uniGUI_Complete_Professional_0.99.96.1346.


  • 0

#4 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 23 October 2017 - 07:09 PM

FMSoft_uniGUI_Complete_Professional_0.99.96.1346.

 

Why not using latest version and build ?!


  • 0

#5 M477H13U

M477H13U

    Member

  • uniGUI Subscriber
  • PipPip
  • 40 posts

Posted 09 November 2017 - 01:33 PM

Hello Lion !

 

I'm using nearly last build and SelStart & SelLength is not found in class TUniEdit; any workaround please ?  :rolleyes:


  • 0

M477h13U,

 

UniGUIVersion: 1.0.0.1416.


#6 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 09 November 2017 - 01:56 PM

Hi,

Ok, we will try to give you a workaround

Best regards,
  • 0

#7 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 10 November 2017 - 11:02 AM

Hi.

A bit later I will try to give you a workaround
  • 0

#8 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 10 November 2017 - 11:23 AM

Can you try this simple implementation ?!:

 

1. MainForm -> Script:

function selectSE(id, start, end) {
    var input = document.getElementById(id);
    if ('selectionStart' in input) {
        input.selectionStart = start;
        input.selectionEnd = end;
        input.focus();
    } else { // Internet Explorer before version 9
        var inputRange = input.createTextRange();
        inputRange.moveStart("character", 1);
        inputRange.collapse();
        inputRange.moveEnd("character", 1);
        inputRange.select();
    }
}

2. How to use, for example:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  UniSession.AddJS('selectSE('+UniEdit1.JSName+'.inputEl.id, 0, 2)');
end;

Best regards,


  • 0

#9 M477H13U

M477H13U

    Member

  • uniGUI Subscriber
  • PipPip
  • 40 posts

Posted 10 November 2017 - 01:31 PM

I tried the simple but unfortunately "selectSE is not defined" when calling it.. I put it in my Main.Script property as you told be, but it does not seems to recognize the fonction; does I have to enable something more ?

 

Best regards,


  • 0

M477h13U,

 

UniGUIVersion: 1.0.0.1416.


#10 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 10 November 2017 - 04:16 PM

Hi,

 

in MainForm -> Script:

 

try to change to this:

var selectSE = function(id, start, end) {
...

or

document.selectSE = function(id, start, end) {
...

  • 0

#11 M477H13U

M477H13U

    Member

  • uniGUI Subscriber
  • PipPip
  • 40 posts

Posted 13 November 2017 - 08:43 AM

Hello Lion ! 

Unfortunately I still got the same issue; any idea ?


  • 0

M477h13U,

 

UniGUIVersion: 1.0.0.1416.


#12 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 13 November 2017 - 08:53 AM

Hi,

Sorry, can you make a simple testcase for this?!
  • 0

#13 M477H13U

M477H13U

    Member

  • uniGUI Subscriber
  • PipPip
  • 40 posts

Posted 13 November 2017 - 05:05 PM

I don't know why, on a minimalist testCase project, I have no issue and highlighting is working properly, but on my own project, function selectSE is never recognize .. any idea ; workaround ?  :(


  • 0

M477h13U,

 

UniGUIVersion: 1.0.0.1416.


#14 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3432 posts

Posted 16 November 2017 - 11:07 AM

Hi,

 

I don't know why, on a minimalist testCase project, I have no issue and highlighting is working properly, but on my own project, function selectSE is never recognize .. any idea ; workaround ?  :(

 

Ok, try this approach:

 

1. MainForm -> Script:

Ext.form.field.Text.prototype._selectSE = function(start, end) {
    var input = document.getElementById(this.inputEl.id);
    if ('selectionStart' in input) {
        input.selectionStart = start;
        input.selectionEnd = end;
        input.focus();
    } else { // Internet Explorer before version 9
        var inputRange = input.createTextRange();
        inputRange.moveStart("character", 1);
        inputRange.collapse();
        inputRange.moveEnd("character", 1);
        inputRange.select();
    }
}

2. Use like this:

UniEdit1.JSInterface.JSCall('_selectSE', [0, 2]);

Best regards,


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users