Author Topic: I've been messing with Dialog Windows and...  (Read 12763 times)

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
I've been messing with Dialog Windows and...
« on: November 11, 2006, 02:15:09 AM »
I've got a few questions about them.

First of all, I set up a window, it has a static text control, a edit box, and a button. The button echoes the contents of the edit box. Now, whenever it echoes it there is always a little box at the end of the string, anyways to get rid of that? Also, even if i Increase the height of the edit box, I can only add one line of text, which makes it stop once it reaches the maximum width of the box. Any way to fix these? i'm trying to refine all my scripts to make them user friendly, for distributing them, ect. Like right now in my trivia script you have to add questions by editing the INI file directly, I'm trying to fix that :)
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: I've been messing with Dialog Windows and...
« Reply #1 on: November 11, 2006, 10:27:59 AM »
I don't know why you would get those little boxes at the end of the edit box, unless your trying to add multiple lines to it.
The edit boxes are not multiline capable by default, and off hand, I am not sure how to make em multiline.
I'll have to research a bit to see how to make em multiline.
The IceChat God

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #2 on: November 11, 2006, 11:45:09 AM »
Code: [Select]
Dim MyDialog
Dim editboxtext
MyDialog = CreateDialog("My Dialog",20,40,250,200)
AddLabel MyDialog,"Edit Box",10,2,100,15, 1
AddEditBox MyDialog,"",10,20,200,150, 2
AddButton MyDialog,"Send",3,180,40,18,3,0,"SendButton"
Sub open()
ShowDialog MyDialog
End Sub

Sub close()
Closedialog MyDialog
End Sub

Sub SendButton_clicked()
editboxtext = GetText(2)
SendCommand "/echo " & editboxtext & ""
End Sub
This message brought to you by the Wonderful Wizard of Oz.

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #3 on: November 11, 2006, 04:45:35 PM »
Also, Sometimes the window wont open when i type /! open and other times wont close when i type /! close. it seems to be random if it wants to or not.
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: I've been messing with Dialog Windows and...
« Reply #4 on: November 11, 2006, 06:24:50 PM »
Its probably best to just Dim the variables outside of the subs, but actually create the Dialogs inside the Open sub.
The IceChat God

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #5 on: November 11, 2006, 07:56:03 PM »
okay, that works better, thanks. my new code is:

Code: [Select]
Dim trivia

Sub open()
trivia = CreateDialog("Trivia Settings",20,40,500,400)
AddLabel trivia,"Channel",10,2,100,15, 1
AddEditBox trivia,"",10,20,200,20, 2
AddButton trivia,"Save",3,180,40,18,3,0,"Save"
ShowDialog trivia
End Sub

Sub close()
Closedialog trivia
End Sub

Sub save_clicked()
channel = GetText(2)
WriteIniFile "trivia.ini","control","channel",channel
SendCommand "/echo Settings Updated."
Closedialog trivia
End Sub

but the very last part doesnt work in the Sub save_clicked(). it writes the channel to the INI file but doesnt echo the command.

EDIT: Changed it around and it works...
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: I've been messing with Dialog Windows and...
« Reply #6 on: November 11, 2006, 08:04:20 PM »
Well, at least your getting the hang of it. :)

Those dialogs can be a bit fussy at times, but they do work great. I will check out that GetText function, and see if its adding an extra null character at the end of it.
The IceChat God

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #7 on: November 22, 2006, 02:22:49 PM »
okay, kinda different subject but still same project so...

do if then statements not work in loops? heres my code:

Code: [Select]
Sub Removeitem_clicked()
cat=GetListItem(1,5)
num=GetListItem(4,5)
cat = "@" & cat
SendCommand "/echo -a " & cat & " " & num
skip = getinifile("quote.ini",cat,num,"")
SendCommand "/echo -a skip: " & skip
total = getinifile("quote.ini","controls","total","0")
SendCommand "/echo -a total: " & total
for a = 1 to total
if a <> skip then
SendCommand "/echo -a " & a
end if
next
End Sub

and i keep getting this back:
Quote
@empress 1
skip: 1
total: 6
1
2
3
4
5
6

but it should be coming back as:

Quote
@empress 1
skip: 1
total: 6
2
3
4
5
6

with the 1 gone. Am i doing something wrong?
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: I've been messing with Dialog Windows and...
« Reply #8 on: November 22, 2006, 03:45:44 PM »
No, the code looks right, and yes, if statements work fine inside loops.
I am guessing that skip isnt really worth "1", but a space after it, or a null character.
I would have to do a bit of testing on this myself, just got some ideas bouncing around in my head.

In the mean time, see if this helps at all: Forces skip to be an integer (number)

Code: [Select]
if a <> int(skip) then
The IceChat God

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #9 on: November 22, 2006, 04:59:47 PM »
that works, thanks.
This message brought to you by the Wonderful Wizard of Oz.

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #10 on: November 25, 2006, 03:38:37 PM »
can you add tooltips to buttons and list boxes ect?
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: I've been messing with Dialog Windows and...
« Reply #11 on: November 25, 2006, 05:01:20 PM »
No, they can not be added.
The IceChat God

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #12 on: November 25, 2006, 06:43:23 PM »
okay, a few questions, all relating to window positions:
1) is there a way to get the current window position when i click a button? (so that if i have window a at x,y i can make window b open at x+50,Y+50)
2) can you change the position of msgbox?
3) can you change the position of the input window?

also, thanks for making the input windows not modal :)
This message brought to you by the Wonderful Wizard of Oz.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: I've been messing with Dialog Windows and...
« Reply #13 on: November 25, 2006, 07:08:27 PM »
Sorry, all no's to everyone of them.
The IceChat God

DarkStar

  • Full Member
  • ***
  • Posts: 135
  • Scripts for Praise
    • CorpseCorp
Re: I've been messing with Dialog Windows and...
« Reply #14 on: November 25, 2006, 11:12:05 PM »
no problem no problem, im just trying to figure out what i got to do :)

Anyways, can you disable buttons and stuff? like grey them out?
This message brought to you by the Wonderful Wizard of Oz.