Skip to content
General IRCd

If (devent == Edit)

A TG007 community discussion started by Silo.

Discussion 5 posts
Page 1 of 1
Open
Topic #10819 · 5 published posts · 1,297 views

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 Aug 17, 2008 10:52 AM by Silo

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
      }
    }

I don't get paid to know the answer, therefore I'm far more likely to give you a straight and honest answer.

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 :)

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.

 

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 ;)