Jump to content

If (devent == Edit)


Silo

Recommended Posts

Hi guys, when making dialogs and it's associated controls, I always made each control seperate. ie on * sclick, dclick, edit init etc all had their own controls. For my control panel I'm working on I'm using a different tact. This time i'm grouping it together using if ($devent == sclick) etc etc. So far it's working out ok, though it's many several lines long, and after tackling various bracket issues I have it working for the most part.

 

Now I'm onto the on edit events and for the life of me, it's just not working. :( I've tried this...

    if ($devent == edit) {
      if ($did = 96) {
        if ($left($did(96).text,96) != $null) did -e $dname 97
        else did -b $dname 97

 

Then tried to clean it up using an $iif (though I'm not sure the syntax is correct)...

    
    if ($devent == edit) {
      if ($did = 96) {
        did $iif($did(96).text) == $null,-b,-e) $dname 97
      }
    }

I've tried nesting it using different bracket forms to no avail. I have two questions.

(A) Does the code look ok?

(B) Do I need to place this in any specific area?

 

All of the varios *click events are all on the same section, though the init has it's own area. SOrry for the long winded post. I hope someone can offer me some advice :)

 

Thanks :)

 

*EDIT* To correctly add my second code in

Edited by Silo
Link to comment
Share on other sites

The two are the same codes so we can't check the second one.

    if ($devent == edit) {
      if ($did = 96) {
        if ($left($did(96).text,96) != $null) did -e $dname 97
        else did -b $dname 97

The $left part is not right, which is probably where you're going wrong. You've told it to check whether the 96th character from the left exists.

 

If memory serves, you can't get mIRC to perform tasks on the dialog just by entering text but if it can, it'd be more along the lines of:

    if ($devent == edit) {
      if ($did == 96) {
        if ($did(96)) did -e $dname 97
        else did -b $dname 97
      }
    }

Link to comment
Share on other sites

Thanks for pointing out my oversight re. my second code example, Tak :) mIRC does recognise edit events, so buttons/controls etc can be disabled unless any text is inputed to the edit box. It's always worked fine for me using my old format, just not with this new synatx.

 

Thanks :)

Link to comment
Share on other sites

The problem with your $iif() statement is that you have closed the bracket too early:

 

did $iif($did(96).text) == $null,-b,-e) $dname 97

 

I have highlighted the brackets in different colours so you can see which ones are matching brackets and which aren't. You need to remove the second blue bracket in order for you to have a bracket match.

 

As for your code, it seems fine. The $left() thing you're doing doesn't make a lot of sense but it shouldn't cause any problems with your code. Maybe the problem lies elsewhere, try posting the entire on dialog code block.

 

Link to comment
Share on other sites

Thank you, Hixxy. I'm at work, so when I get home I'll try it out. Hopefully i will work okay. Problem will no doubt rest between the keyboard and the chair ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...