Commands in RichText?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Commands in RichText?

    Is it possible to create some commands in RichText
    for ex. when u will type /quit the application will exit when u type /minimize the application will minimize etc.
  • Imagine Programming
    Indigo Rose Customer
    • Apr 2007
    • 4252

    #2
    well... if you had a one line richtext you could do this

    PHP Code:
    --On Key event of richtext

    if(e_Key==13)then
    sCommand
    =RichText.GetText(thisfalse);
    if(
    sCommand=="/quit")then
        Application
    .Exit(0);
    elseif(
    sCommand=="/minimize")then
        Application
    .Minimize();
    else
        
    Dialog.Message("Error""Unrecognized command!");
    end
    RichText
    .SetText(this""false);
    end 
    Bas Groothedde
    Imagine Programming :: Blog

    AMS8 Plugins
    IMXLH Compiler

    Comment


    • #3
      Originally posted by C B programming and webdesign View Post
      well... if you had a one line richtext you could do this

      PHP Code:
      --On Key event of richtext

      if(e_Key==13)then
      sCommand
      =RichText.GetText(thisfalse);
      if(
      sCommand=="/quit")then
          Application
      .Exit(0);
      elseif(
      sCommand=="/minimize")then
          Application
      .Minimize();
      else
          
      Dialog.Message("Error""Unrecognized command!");
      end
      RichText
      .SetText(this""false);
      end 
      it's not working :(
      when i type /quit or /minimize it says Unrecognized command! :(
      Help!

      Comment

      • Imagine Programming
        Indigo Rose Customer
        • Apr 2007
        • 4252

        #4
        no not when you type but after you've pressed enter...

        besides that type it right... cos it works fine with me...
        Bas Groothedde
        Imagine Programming :: Blog

        AMS8 Plugins
        IMXLH Compiler

        Comment


        • #5
          Originally posted by C B programming and webdesign View Post
          no not when you type but after you've pressed enter...

          besides that type it right... cos it works fine with me...
          I pressed Enter also when i typed /quit but it's showing that message :(

          Comment


          • #6
            can u post it as an example then maybe it should work

            Comment

            • longedge
              Indigo Rose Customer
              • Aug 2003
              • 2498

              #7
              Just guessing, 'On Key' events usually occur as soon as a key has been pressed so the first character would trigger the event wouldn't it?

              Comment

              • Imagine Programming
                Indigo Rose Customer
                • Apr 2007
                • 4252

                #8
                Originally posted by longedge View Post
                Just guessing, 'On Key' events usually occur as soon as a key has been pressed so the first character would trigger the event wouldn't it?
                i've put if(e_Key==13)then in there... so it'll only fire on Pressing return/enter
                Code:
                if(e_Key==13)then --Checking if Enter/Return == pressed
                sCommand=RichText.GetText(this, false);
                sCommand=String.Replace(sCommand, "\r\n", "", false)
                if(sCommand=="/quit")then
                    Application.Exit(0);
                elseif(sCommand=="/minimize")then
                    Application.Minimize();
                else
                    Dialog.Message("Error", "Unrecognized command!");
                end
                RichText.SetText(this, "", false);
                end
                Last edited by Imagine Programming; 07-01-2008, 11:27 AM.
                Bas Groothedde
                Imagine Programming :: Blog

                AMS8 Plugins
                IMXLH Compiler

                Comment

                • Imagine Programming
                  Indigo Rose Customer
                  • Apr 2007
                  • 4252

                  #9
                  Here you go... example
                  Attached Files
                  Bas Groothedde
                  Imagine Programming :: Blog

                  AMS8 Plugins
                  IMXLH Compiler

                  Comment

                  • longedge
                    Indigo Rose Customer
                    • Aug 2003
                    • 2498

                    #10
                    Originally posted by C B programming and webdesign View Post
                    i've put if(e_Key==13)then in there... so it'll only fire on Pressing return/enter
                    Ah.. yes sorry, I should've checked the virtual key codes.

                    Comment


                    • #11
                      thnx now it's working

                      Comment

                      • Imagine Programming
                        Indigo Rose Customer
                        • Apr 2007
                        • 4252

                        #12
                        Originally posted by longedge View Post
                        Ah.. yes sorry, I should've checked the virtual key codes.
                        Ah well don't worry, i had a delete function in a listbox once but i forgot its keycode... so on every key i deleted an item in the listbox :lol
                        Bas Groothedde
                        Imagine Programming :: Blog

                        AMS8 Plugins
                        IMXLH Compiler

                        Comment

                        Working...
                        X