mIRC Homepage
Posted By: neophyte Autocomplete in editable drop boxes - 15/09/03 06:35 AM
I would like to make the suggestion of adding another paramater that makes an editable drop box auto complete, based on what is being typed, and what is in the drop box.

For example, if a list such as listed below, was in a drop box, and the user started to type in the letters "Ite", the drop box would start to auto complete the word being typed, reverse highlighting the last bit of it, so that the user can keep typing (an example of this, is the Auto complete feature in Internet Explorer's address bar).

Drop down list:

Item 1
Item 2
Item 3
Item 4


The proposed addition is acomp (or something to that effect), that would be used just like the other paramaters available for a drop down listbox in mIRC dialogs.

combo id, x y w h, style (sort, edit, drop, size, vsbar, hsbar, acomp)

Please post your feedback.
Posted By: sparta Re: Autocomplete in editable drop boxes - 15/09/03 06:42 AM
A good idea, but i dont think Khaled want to add that, thats like a script, and if you look at mIRC it's realy clean, no stuff that you dont use.. so i belive that if you want a thing like that you have to make your own..
Posted By: cold Re: Autocomplete in editable drop boxes - 15/09/03 01:35 PM
I don't understand your point.. what he suggests seems "clean" enough to me.

Plus - correct me if I'm wrong - a script can't select text from the editbox control of a combo. "/did -c <dlg> <id> N <range>", if N is 0, unchecks any selected line (rather than selecting <range> characters from the editable text). If N isn't 0, it only selects Nth line. Using it along with the -k parameter does nothing.
Posted By: KingTomato Re: Autocomplete in editable drop boxes - 15/09/03 03:13 PM
Code:
alias acomp {
  var %dialog = acomp
  if ($dialog(%dialog)) /dialog -vie %dialog
  else /dialog -md %dialog %dialog
}
dialog acomp {
  title "Auto Complete"
  size -1 -1 90 50
  option dbu
  combo 1, 0 1 65 50, sort size edit
  button "Close", 2, 65 1 25 12, cancel
}

on 1:DIALOG:acomp:INIT:*: {
  var %a = 0
  while (%a &lt; 100) {
    /did $iif(%a == 0, -ca, -a) $dname 1 $+($rand(a,z),$rand(a,z),$rand(a,z),$rand(a,z),$rand(a,z))
    /inc %a
  }
}

on 1:DIALOG:acomp:EDIT:1: {
  var %a = $did(1).lines
  while (%a &gt; 0) {
    if ($did($dname, 1).text iswm $did($dname, 1, %a).Text) {
      /did -c $dname 1 %a
      return
    }
    /dec %a
  }
}


Til its implimented, heres an example. You may have the workaround already, but maybe someone else wants it >:D
Posted By: cold Re: Autocomplete in editable drop boxes - 15/09/03 11:08 PM
That's not what he's suggesting.
What he says mIRC should support is something most browsers do, like when typing "www.mir", the browser completes it to "www.mirc.com", but it still keeps the cursor after the 'r' and selects "c.com", so you can keep typing if going to mirc.com isn't your intention.
Your script either doesn't do that or fails (I've tested it).
Posted By: KingTomato Re: Autocomplete in editable drop boxes - 16/09/03 12:45 AM
I realise what they were requesting. My point is until its added, there is a fix. The point of autocomplete is to offer the best possible match based on what the user has already typed. Seems to me mine does. If they type abc out of abcdef, it shows abcdef at the top (i.e., best fit).
Posted By: cold Re: Autocomplete in editable drop boxes - 16/09/03 04:01 AM
As another alternative, it's fine. smile
Posted By: neophyte Re: Autocomplete in editable drop boxes - 16/09/03 07:42 AM
I had issues getting that to work, but I can see your point.
While it may be a "workaround" for the time being, just imagine if you had to implement that across a multitude of dialogs (I have quite a lot of dialogs within my script that use editable dropdown menus).

But you've got me thinking smile

Anyway, I'm quite sure that something as simple as making a dropdown menu or even list boxes that are editable, have an auto complete, would be rather clean, and easy to do, but I'm not much of a programmer, so I can't really be sure.


I for one, would really like to see this implementation.
Posted By: rubyrubz Re: Autocomplete in editable drop boxes - 16/09/03 08:05 AM
that autocomplete in editable drop boxes idea is good...
Posted By: KingTomato Re: Autocomplete in editable drop boxes - 16/09/03 02:22 PM
Code:
alias acomp {
  var %dialog = acomp
  if ($dialog(%dialog)) /dialog -vie %dialog
  else /dialog -md %dialog %dialog
}

dialog acomp {
  title "Auto Complete"
  size -1 -1 120 63
  option dbu
  combo 1, 0 0 60 50, sort size edit
  combo 2, 60 0 60 50, sort size edit
  button "Close", 3, 80 50 40 12, ok
}

on 1:DIALOG:acomp:INIT:*: {
  /acomp.init $dname 1
  /acomp.init $dname 2
}

on 1:DIALOG:acomp:EDIT:*: {
  /autocomp $dname $did
}

alias acomp.init {
  var %dname = $1, %did = $2, %a = 0
  while (%a &lt; 100) {
    /did $iif(%a == 0, -ca, -a) %dname %did $+($rand(a,z),$rand(a,z),$rand(a,z),$rand(a,z),$rand(a,z))
    /inc %a
  }
}

alias autocomp {
  var %dname = $1, %did = $2
  var %a = $did(%dname, %did).lines
  while (%a &gt; 0) {
    if ($did(%dname, %did1).text iswm $did(%dname, %did, %a).Text) {
      /did -c %dname %did %a
      return
    }
    /dec %a
  }
}


To solve your multiple dropdown problem all i did was make the function an alias, then used it for both the id's. I send it dname and id, and it took care of the rest.

(Sry ruby for using you as the eploy to, but u were the closest to bottom >:D)
Posted By: trenzterra Re: Autocomplete in editable drop boxes - 18/09/03 02:40 PM
If you have auto complete, there should be a place to clear forms too...
Posted By: neophyte Re: Autocomplete in editable drop boxes - 18/09/03 02:56 PM
Thats not the kind of auto complete I'm thinking about.


When you type text into an editable dropmenu/listbox, it should auto complete the text string based on what choices are available in the dropmenu/listbox, but allowing you to keep typing away.

Kinda like how the IE address bar works.
Posted By: Ecronika An Example - 20/09/03 12:23 PM
Code:
;author Ecronika
;script Example to Autocomplete an editable drop down combo
;version 1.0
;public acomp

alias acomp {
  ;syntax /acomp
  ;description Opens the Auto Complete Dialog to test my code.
  ;returns null

  dialog $iif($dialog(acomp),-v,-m acomp) acomp
}
alias -l acomp.init {
  if ($dialog(acomp)) {
    didtok acomp 1 44 hehe,haha,test entry,something,stupid
    did -f acomp 2
  }
}
alias -l acomp.edit {
  if ($dialog(acomp)) {
    if ($didwm(acomp,1,$+($did(acomp,2),*))) {
      var %l $calc($len($did(acomp,2).text) +1)
      did -o acomp 2 1 $did(acomp,1,$ifmatch)
      did -c acomp 2 1 $calc($len($did(acomp,2).text) +1) %l
    }
  }
}
dialog -l acomp {
  title "Auto Complete"
  size -1 -1 90 42
  option dbu
  combo 1, 6 6 78 56, size edit drop
  edit "", 2, 6 6 69 10
  button "&amp;Close", 3, 48 24 37 12, ok
}
on *:dialog:acomp:init:0: { .timer -m 1 0 acomp.init }
on *:dialog:acomp:edit:2: { .timer -m 1 0 acomp.edit }
 


It is just a workaround and not perfect but it works (for me)
Posted By: Ecronika Re: An Example - 20/09/03 12:37 PM
Code:
;author Ecronika
;script Example to Autocomplete an editable drop down combo
;version 1.1
;public acomp

alias acomp {
  ;syntax /acomp
  ;description Opens the Auto Complete Dialog to test my code.
  ;returns null

  dialog $iif($dialog(acomp),-v,-m acomp) acomp
}
alias -l acomp.init {
  if (!$dialog(acomp)) { return }
  didtok acomp 1 44 hehe,haha,test entry,something,stupid
  did -f acomp 2
}
alias -l acomp.edit {
  if (!$dialog(acomp)) { return }
  if ($didwm(acomp,1,$+($did(acomp,2),*))) {
    var %l $calc($len($did(acomp,2).text) +1)
    did -o acomp 2 1 $did(acomp,1,$ifmatch)
    did -c acomp 2 1 $calc($len($did(acomp,2).text) +1) %l
  }
}
alias -l acomp.select {
  if (!$dialog(acomp)) { return }
  did -of acomp 2 1 $did(acomp,1,0).text
  did -c acomp 2 1 1 $calc($len($did(acomp,2).text) +1)
}
dialog -l acomp {
  title "Auto Complete"
  size -1 -1 90 42
  option dbu notheme
  combo 1, 6 6 78 56, size edit drop
  edit "", 2, 6 6 69 10
  button "&amp;Close", 3, 48 24 37 12, ok
}
on *:dialog:acomp:init:0: { .timer -m 1 0 acomp.init }
on *:dialog:acomp:edit:2: { .timer -m 1 0 acomp.edit }
on *:dialog:acomp:sclick:1: { .timer -m 1 0 acomp.select }  


Choose out of dropdown box now works too.
© mIRC Discussion Forums