highlighting fill-in

snooker

New Member
Hi all,

I am trying to highlight part of the text in a fill-in area. For example,

fill-in-1:screen-value = "this is an example".

I want to highlight the "an example" part by clicking a button in the interface or in a trigger procedure. In other words i want to select a part of the text of fill-in value.

Is it possible? If possible how?

Thank you...
 

Cringer

ProgressTalk.com Moderator
Staff member
I don't think it is possible. What do you want to do with the highlighted text once you have it? Maybe there's a work-around.
 

RealHeavyDude

Well-Known Member
That is not entirely true. There is a SET-SELECTION () method available to some widgets that lets you specify the offsets. Plus there is an SELECTION-START and SELECTION-END attribute available to get the offsets of the selection. I think that is exactly what he needs.

Heavy Regards, RealHeavyDude.
 

snooker

New Member
Indeed I am trying to make a mail-delivery screen. I want the fill-in area to work like "To" field in outlook. When a user starts to write an e-mail address, the progress should bring the first matching address from the mail list by using "FIND FIRST" and "BEGINS" criteria, and should highlight the unwritten part of the address in the fill-in area. By this way the user can continue typing the address if the first match is nott he mail address that user wants to write. Furthermore, in the fill-in area the address' are seperated by commas, therefore the solution should work for the last entry after the last comma.

As cringer said, there is a SET-SELECTION method that you can define starting position end end position of selection. However I couldnt use that method with a correct syntax.
 

Cringer

ProgressTalk.com Moderator
Staff member
Apologies for my ignorance - never seen the SET-SELECTION methods before. :)
At my last place we had a solution for what you wanted, but I can't remember exactly how it was implemented. I know the code created a dynamic browse based on the entered information. I don't think it highlighted the text after the cursor though, but you were able to keep typing until you got a complete unique match or selected a record with the mouse.
I'm sorry I can't be more specific with this. For one I don't have the code to hand, and even if I did it's not my code to broadcast.
 

snooker

New Member
I have solved my problem by using SET-SELECTION method. In the first step i was using EDITOR WIDGET. However, editor-widget creates some problem. When you use some code in the "DELETE" or "BACKSPACE" trigger in an editor widget, you lose the main function of DELETE and BACKSPACE keys. Therefore i used the SET-SELECTION method in the FILL-IN widget. SET-SELECTION method works perfectly in a fill-in.

Also i gave up using commas to seperate e-mail addresses. I just use one e-mail address in a fill-in and by RETURN trigger i write the screen-value of the fill-in into an editor screen-value by putting commas between addresses.

Thanks for all replies.. and no need for apologise :)
 

snooker

New Member
Here it is the code i have used.

Code:
[COLOR=#0000ff]FIND FIRST[/COLOR] mail-list
    [COLOR=#0000ff]WHERE[/COLOR] mail-list.email [COLOR=#0000ff]BEGINS[/COLOR] mail-start [COLOR=#0000ff]NO-ERROR[/COLOR].

[COLOR=#0000ff]IF AVAILABLE[/COLOR] mail-list [COLOR=#0000ff]THEN DO:
[/COLOR]   fil-to:[COLOR=#0000ff]SCREEN-VALUE [/COLOR]= [COLOR=#0000ff]TRIM[/COLOR](mail-list.email).
   fil-to:[COLOR=#0000ff]SET-SELECTION[/COLOR]([COLOR=#0000ff]LENGTH[/COLOR](mail-start) + 1, [COLOR=#0000ff]LENGTH[/COLOR]([COLOR=#0000ff]TRIM[/COLOR](mail-list.email)) + 1).
[COLOR=#0000ff]END.

IF NOT AVAILABLE[/COLOR] mail-list [COLOR=#0000ff]THEN DO:
[/COLOR]   fil-to:[COLOR=#0000ff]SCREEN-VALUE [/COLOR]= [COLOR=#0000ff]TRIM[/COLOR](mail-start).
   fil-to:[COLOR=#0000ff]CURSOR-OFFSET [/COLOR]= [COLOR=#0000ff]LENGTH[/COLOR]([COLOR=#0000ff]TRIM[/COLOR](mail-start)) + 1.
[COLOR=#0000ff]END[/COLOR].

mail-start is a variable to keep the value of printed keys. In other words to keep the value of unhighlighted part of the fill-in screen-value.
 
Top