You could always use Enumeration so no two MenuIDs will ever be the same.
> #PB_Any is NEEDED
Not needed, but maybe highly desirable.

Code: Select all
If found = 0
AddElement(Whisper())
Whisper()\Partner = p
Whisper()\Window = OpenWindow(#PB_Any, 0, 0, 100, 100, #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_SystemMenu, "Whisper to "+Whisper()\Partner)
If CreateGadgetList(WindowID()) = 0
Error("Could not open Window!")
EndIf
Whisper()\History = EditorGadget(#PB_Any, 0, 0, 100, 80)
Whisper()\NewMsg = StringGadget(#PB_Any, 0, 80, 100, 20, "")
Whisper()\Menu = AddKeyboardShortcut(Whisper()\Window, #PB_Shortcut_Return, #PB_Any)
EndIf
SetGadgetText(Whisper()\NewMsg, text)
Code: Select all
ForEach Whisper()
If Whisper()\Menu = event
String = GetGadgetText(Whisper()\NewMsg)
AddGadgetItem(Whisper()\History, -1, User+":"+String)
String = "/w "+Whisper()\Partner+" "+String
If Len(String) > 4090
Packet_Size(Len(String)+6)
EndIf
Packet_New(#nMsg_ChatMsg)
Packet_AddString(String)
Packet_Send()
SetGadgetText(Whisper()\NewMsg, "")
EndIf
Next
Dummy wrote: Maybe this'll work??
Windows creation:Code: Select all
; ... Whisper()\History = EditorGadget(#PB_Any, 0, 0, 100, 80) Whisper()\NewMsg = StringGadget(#PB_Any, 0, 80, 100, 20, "") Whisper()\Menu = Whisper()\Window AddKeyboardShortcut(Whisper()\Window, #PB_Shortcut_Return, Whisper()\Window) , ...
ever tried that?PB wrote:> You can just get EventWindowID() and figure out which window it was used on
Exactly! Each AddKeyboardShortcut can then have the same MenuID, without
the need to worry about it clashing with any other MenuIDs.
hmmm but that dirty codeMaybe this'll work??
Windows creation:
Code:
; ...
Whisper()\History = EditorGadget(#PB_Any, 0, 0, 100, 80)
Whisper()\NewMsg = StringGadget(#PB_Any, 0, 80, 100, 20, "")
Whisper()\Menu = Whisper()\Window
AddKeyboardShortcut(Whisper()\Window, #PB_Shortcut_Return, Whisper()\Window)
, ...