![]() |
Few questions
I have just a couple questions (mostly dealing with GUI stuff) and I don't really want to make three different topics, so I'll just do it all here.
First of all, about using onAction to check if the return key has been pressed in a text edit control, (I've decided to script a sort of instant-messaging thing just to test GUI functionalities) I have a dynamic GUI: PHP Code:
PHP Code:
Only the send button sends the trigger though, for some reason pressing return in a textedit doesn't seem to be invoking onAction. I've tried using autoindent = false, incase maybe indenting is causing it to not sent onAction or something, but that didn't seem to help. Second question, can anyone explain how TextList columns work; how to add a column and choose which column to add text to, etc.? I've looked up the syntax on the graalwiki and graalbible and I've seen how they're supposed to be set up but didn't really understand the explanation for that since there wasn't any sort of example of them being used. Third, I have a scrit that uses loadLines to load files from a text file into an array. LoadLines works perfectly, and I can retrieve the data and use it just fine. When I try to use saveLines on the exact same file, nothing seems to save to the files. It's like it can only read from the file and not write to it. I've double checked that the NPC server has write rights, this is the exact line from the folder rights for (npcserver): rw logs/profiles/*.txt So it should be able to both read from and write to the file. Anyone else having this problem? Thanks :] |
First: I'm not certain that onAction() is called for a GuiMLTextCtrl ... I recommend simply a GuiTextCtrl, there's no reason you need a multi-line one anyway.
Second: Text list columns work like this: PHP Code:
PHP Code:
|
Quote:
"onAction() - is invoked when a button control is pressed, you press the enter-key in a text edit control, or move a slider control" I think it would look a little strange to have an instant messaging window that when you sent a message it just put it as text on the window itself instead of displaying it in a text box. Not sure o: Quote:
Quote:
PHP Code:
"Hello","these","are","test","lines" Echo from temp.b: "The_Kez" Like I said, no change is being made to the file at all. |
Your NPC-Server has rights to logs/profiles/*.txt, but you're trying to write to a file in profiles/*.txt. Your NPC-Server needs read-write rights to profiles/*.txt. Either that, or you need to use temp.a.saveLines("logs/profiles/profile_" @ params[1] @".txt",0);
|
Quote:
PHP Code:
The exact filepath (checking from the file browser) is: logs/profiles/profile_The_Kez.txt So I don't know, I'm baffled by this one. |
I'm wondering if logs is only writable via savelog()/savelog2()...
You said that you've tried removing the "logs/" part of the path, but have you tried giving your NPC-Server read-write rights to profiles/*.txt and pointing savelines() to there? |
Yup, I gave that a try and the files are updating now when you do it directly to profiles as a basefolder so I guess that was the issue.
Thanks for the help :) |
Quote:
|
Bah, I had the controls mixed up. Is there any way I can check if enter has been pressed from a MLTextEdit?
|
You can use onKeyDown() for a GuiMLTextEdtCtrl. However, you'll have to sacrifice line breaks. I believe the ENTER key is keycode 28.
|
Quote:
PHP Code:
|
Hmm...well like I said this is a dynamic GUI, I looked it up and 28 is indeed enter, but - since it's dynamic and I have to use catchevent how can I check what the keycode is? Because it does...
thiso.catchevent( this.name, "onKeyDown", "onSendMessage" ); So the paramaters for onSendMessage would only be the object, the keycode would be lost wouldn't it? EDIT: I've figured this one out for myself so this thread is no longer necessary. Thanks again for the help everyone :) |
All times are GMT +2. The time now is 08:22 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.