:Start of GadgetXDictionary <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> <html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>GadgetXDictionary.dsc</title><STYLE>BODY{FONT-SIZE: 12px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #ffffed } A{COLOR: Blue} A:active {FONT-WEIGHT: bold; COLOR: #008000} A:visited{FONT-WEIGHT: bold; COLOR: #400000} A:hover{ FONT-WEIGHT: bold; COLOR: #008000;} H1{COLOR: #400000; TEXT-ALIGN: left FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif} #copyright { border-top: 2px solid rgb(165, 82, 0); width: 100%; } DIV.left{TEXT-ALIGN: left} DIV.centered{TEXT-ALIGN: center}</STYLE></head><body bgcolor=#ffffed><table width="100%" height="133"><tr height="129"><th width="173"><a href = "http://www.dragonsphere.net" target = "_blank"><img style="Z-INDEX: 100; LEFT: 25px; POSITION: absolute; TOP: 40px" height="124" alt="DragonSphere" src="http://www.dragonsphere.net/images/dragonfly.png" width="169" align="left" border="0"></a></th><th><a href = "http://www.dragonsphere.net" target = "_blank"><img style="Z-INDEX: 100; LEFT: 200px; POSITION: absolute; TOP: 40px" height="124" alt="Software" src="http://www.dragonsphere.net/images/dslogotext.png" width="473" align="left" border="0"></a></th></tr></table><br/><!--

#DEFINE COMMAND,<!--
#DEFINE COMMAND,-->
<!-- This is crazy but now we should be able to see this script in the browser and run it in VDS too without changing the source code. --><h1>DragonSphere Software Demos</h1><br/><p>If you are viewing this script in your browser you can save it as a VDS 5.x source file (*.dsc) to run it.</p><br/><hr><br/><pre>
#
# <a href = "http://www.dragonsphere.net" target = "_blank">DragonSphere Software's Home Page</a>
#  
# <a href = "http://www.dragonsphere.net/products/gadgetx/demos/dictionary.zip">All Source Files for this demo</a>
#
# This Script demostartes the use of the GadgetX Dictionary commands and functions.
#

Title GadgetX Dictionary
If @Greater(@Name(@SYSINFO(DSVER)),4)
<!-- GadgetX --><a href = "http://www.dragonsphere.net/products/gadgetx/gadgetx.zip">
External gadgetx.dll,@Sysinfo(DSVER)
<!-- GadgetX --></a>
  #DEFINE COMMAND,DEFINE,DICTIONARY
  #DEFINE FUNCTION,DICTIONARY
Else
  Warn This demo will only work with VDS 5+
  Stop
End
# Define your dictionary
Define Dictionary,IMSlang 
# Load the dict.txt
Dictionary LoadFile,IMSlang,@Path(%0)dict.txt

  DIALOG CREATE,IM Slang Gadget,-1,0,146,136,SNAP,SMALLCAP
REM *** Modified by Dialog Designer on 3/4/2007 - 10:31 ***
  DIALOG ADD,TEXT,TEXT1,1,5,30,13,Slang:
  DIALOG ADD,COMBO,COMBO1,16,5,139,21,,,CLICK,EXIT,SORTED
  DIALOG ADD,TEXT,TEXT2,41,5,49,13,Definition:
  DIALOG ADD,EDIT,EDIT2,55,5,137,75,,,WRAP,MULTI,SCROLL
  DIALOG SHOW
  List Assign,COMBO1,@Dictionary(NAMES,IMSlang)
  %%OldText = @dlgtext(COMBO1)
:evloop 
  wait event,0.3
  %E = @event() 
  If %E 
    goto %E
  End 
goto evloop 
:TIMER
  %B =
  %Z =
  %A = @dlgtext(COMBO1)
  if %A
    %A = @lower(%A)
    if @UnEqual(%A,%%OldText)
      %%OldText = %A
      %L = @len(%A)
      %c = 1
      %W = @substr(%A,1,1)
      while @Not(@Equal(%c,%L))
        %W = %W?
        %B = %B@Dictionary(PARTIAL,IMSlang,%W,?,NAMES)
        If %B
          %B = @Trim(%B)@CR()
        End
        %c = @succ(%c)
      wend
      %B = @Trim(%B)
      If @NULL(%B)
        %B = @Dictionary(NEAR,IMSlang,%A,@succ(@len(%A)),NAMES)
      End
      List clear,COMBO1
      List Assign,COMBO1,%B
      Dialog set,COMBO1,%A
      WINDOW SEND,~COMBO1,@KEY(END)
    end
  end
goto evloop
:COMBO1EXIT
  %A = @dlgtext(COMBO1) 
  if %A
    %B = @match(COMBO1,%A)
  end
goto COMBO1CLICK  
:COMBO1CLICK
   %A = @Item(COMBO1) 
   if %A
    DIALOG SET,COMBO1,%A 
    Window Send,~COMBO1,@KEY(END)    
    %%Found = @Dictionary(Find,IMSlang,@LOWER(%A)) 
    If %%Found
      Dialog Set,EDIT2,%%Found
    Else 
      Dialog Set,EDIT2,
    End 
  else
    Dialog Set,EDIT2,
  end 
goto evloop
:QUITBUTTON 
:CLOSE 
    #%%Values = @Dictionary(TEXT,IMSlang," = ") 
    
    Dictionary SaveFile,IMSlang,@Path(%0)dictpairs.txt,TEXT
    Dictionary SaveFile,IMSlang,@Path(%0)dictnames.txt,NAMES
    Dictionary SaveFile,IMSlang,@Path(%0)dictvalues.txt,VALUES
    Dictionary Close,IMSlang
Exit

:<!-- 
:-->
