mIRC Homepage
Posted By: synth7 A dialog question - 21/12/05 07:41 PM


As you can see, I have a listbox of current away messages (stored in synaway.ini), with an 'Add New Away Reason' button that bring up the Away Reason Editor dialog you see there. The 'Edit' and 'Delete' Buttons are disabled (greyed out) when you don't have an away message selected in the listbox. Right now, the 'Edit' button does nothing at all.

Now, my question is, is there a way I can make the 'Edit' button bring up the Away Editor window with the rest of the values already filled in?
Posted By: MikeChat Re: A dialog question - 21/12/05 09:36 PM
the short answer is: YES

in the init section, load the current value (I'm guessing you weren't specific here) in the main dialog into the correct IDs in the editor dialog
Posted By: synth7 Re: A dialog question - 21/12/05 10:48 PM
Ok I got it to work, sort of.... here's the code

Code:
      if ($did = 48) {
        dialog -m away.editor away.editor
        did -a away.editor 4 $did($dname,37).seltext
        did -a away.editor 5 $gettok($readini(synaway.ini,AWAYS,$did($dname,37).seltext),1,32)
        did -a away.editor 6 $gettok($readini(synaway.ini,AWAYS,$did($dname,37).seltext),2-,32)
      }


The away's are in the ini in this format...

Sleep=sleep i am currently sleeping, aff

Red is the Away Title, Green is the nick suffix (ex. synth7|sleep), and Blue is the reason in the channel message. You can probably figure out the /did commands with that info

However, after I click the "Save" button in the Editor, it adds a new entry under the last one, with the same info as the original one. How can make it either a) just edit the old one, or b) delete the old one and put the new one where it was.
Posted By: HAMM3R Re: A dialog question - 21/12/05 10:57 PM
Well, if you changed the title, it would be a whole new away reason. Maybe block that and tell the user to create a NEW one. As far as editing it, then adding without replacing to the list, I would suggest making an alias that fills the list. Such as awaylist.fill. And call that after you add or edit something. This way instead of adding and deleting from the list after every change, just add/edit the info in the ini file with the dialog, then call the alias at the end to read from the ini file and fill in the list with the corrected stuff.

Btw: you may run into a problem with your tokens if an user adds a away title more than 1 word. You may want to limit to one word, or add to the ini file seperated with a unique char, like $cr. Then run your $gettok with $cr (which is 13). Just a thought.
Posted By: ZANI Re: A dialog question - 22/12/05 10:04 AM
confused u people comfuse me! can u maybe xplain what is the main reason for the question is?
© mIRC Discussion Forums