mIRC Home    About    Download    Register    News    Help

Print Thread
#137897 21/12/05 07:41 PM
Joined: Jul 2004
Posts: 59
S
synth7 Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jul 2004
Posts: 59


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?



#137898 21/12/05 09:36 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
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

#137899 21/12/05 10:48 PM
Joined: Jul 2004
Posts: 59
S
synth7 Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jul 2004
Posts: 59
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.



#137900 21/12/05 10:57 PM
Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
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.


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#137901 22/12/05 10:04 AM
Joined: Dec 2005
Posts: 1
Z
Mostly harmless
Offline
Mostly harmless
Z
Joined: Dec 2005
Posts: 1
confused u people comfuse me! can u maybe xplain what is the main reason for the question is?


Link Copied to Clipboard