Post by Azan on Jul 10, 2005 11:46:33 GMT -5
here it is
current version 1.1
Its open Source, feel free to modify it but please tell me that you are using it
Note this module is for inserting information, its not to be used like a chat thing as the box doesnt clear itself, I will be releasing a module that can do that though.
current version 1.1
Its open Source, feel free to modify it but please tell me that you are using it
Note this module is for inserting information, its not to be used like a chat thing as the box doesnt clear itself, I will be releasing a module that can do that though.
Type inpbox
Field x#,y#,width#,height#,maxlegnth,name$,active,clicked
Field insidered,insidegreen,insideblue
Field borderred,bordergreen,borderblue
Field chat$,linex,counter
End Type
Function inputboxes()
updateinpbox()
End Function
Function inpbox(x#,y#,width#,height#,maxlegnth,name$,active,insidered,insidegreen,insideblue,borderred,bordergreen,borderblue)
i.inpbox=New inpbox
i\x#=x#
i\y#=y#
i\width#=width#
i\height#=height#
i\maxlegnth=maxlegnth
i\name$=name$
i\active=active
i\clicked=False
i\linex=i\x+4
i\counter=0
i\insidered=insidered
i\insidegreen=insidegreen
i\insideblue=insideblue
i\borderred=borderred
i\bordergreen=bordergreen
i\borderblue=borderblue
End Function
Function updateinpbox()
For i.inpbox=Each inpbox
If i\active=True Then
Local centery#=i\y+i\height#/2
Local mx=MouseX()
Local my=MouseY()
Color i\borderred,i\bordergreen,i\borderblue
Rect i\x#,i\y#,i\width#,i\height#
Color i\insidered,i\insidegreen,i\insideblue
Rect i\x#+2,i\y#+2,i\width#-4,i\height#-4
;;;;;;;;;;;;;;;;;;
If MouseDown(1) Then
If i\clicked=True Then
i\clicked=False
EndIf
If i\clicked=False Then
If mx<=i\x+i\width# And mx>=i\x Then
If my<=i\y+i\height# And my>=i\y And i\clicked=False Then
i\clicked=True
FlushKeys
EndIf
EndIf
EndIf
EndIf
EndIf
;;;;;;;;;;;;;;;;
If i\clicked=True And i\active=True Then
Color i\borderred,i\bordergreen,i\borderblue
i\counter=i\counter+1
If i\counter<80 And i\counter>20 Then
Line i\linex,centery#+7,i\linex,centery#-7
EndIf
If i\counter>=80 Then
i\counter=0
EndIf
key=GetKey()
If key Then
If key=8 Or KeyDown(8) Then
If Len(i\chat$)>0 Then
i\chat$=Left$(i\chat$,Len(i\chat$)-1)
i\linex=i\linex-7.5
EndIf
EndIf
If key>=32 And key<127 Or KeyDown(key) Then
i\chat$=i\chat$+Chr$(key)
i\linex=i\linex+7.5
EndIf
If i\maxlegnth<=0 Then
If Len(i\chat$)>i\width#/8 Then
i\chat$=Left$(i\chat$,Len(i\chat$)-1)
i\linex=i\linex-7.5
EndIf
Else:
If Len(i\chat$)>i\maxlegnth Then
i\chat$=Left$(i\chat$,Len(i\chat$)-1)
i\linex=i\linex-7.5
EndIf
EndIf
EndIf
EndIf
If i\active=True Then
Color i\borderred,i\bordergreen,i\borderblue
Text i\x+2,centery#-7,i\chat$
EndIf
Next
End Function
Function inputbox$(name$)
For i.inpbox=Each inpbox
If i\name$=name$ And i\clicked=False Then
Return i\chat$
EndIf
Next
End Function
Function hideinputbox(name$)
For i.inpbox=Each inpbox
If i\name$=name$ And i\active=True And i\clicked=False Then
i\active=False
EndIf
Next
End Function
Function unhideinputbox(name$)
For i.inpbox=Each inpbox
If i\name$=name$ And i\active=False Then
i\active=True
EndIf
Next
End Function