Page 2 of 2
Posted: Sat Sep 17, 2005 11:15 am
by PB
> if i create multiple shourtcuts with the same MenuID they override the old ones
You could always use Enumeration so no two MenuIDs will ever be the same.
> #PB_Any is NEEDED
Not needed, but maybe highly desirable.

Posted: Sat Sep 17, 2005 11:24 am
by Dummy
Whisper() is a linked list containing all whisper(=privatechat)windows
Windows creation:
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)
Event Check:
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
Now please give me the code to obtain free MenuIDs for the Shortcuts!
-Since there is no GetFreeMenuID() command that doesnt work
-#PB_any is not supported und u don't want it to
-Constants cant be used as the count of whisperwindows variies
Posted: Sat Sep 17, 2005 11:39 am
by Pupil
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)
, ...
Posted: Sat Sep 17, 2005 11:48 am
by Killswitch
Why does it need to be changed? You can just get EventWindowID() and figure out which window it was used on.
Posted: Sat Sep 17, 2005 12:02 pm
by PB
> 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.
Posted: Sat Sep 17, 2005 1:34 pm
by Dummy
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.
ever tried that?
Maybe 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)
, ...
hmmm but that dirty code
can couze bugs
i dont like buggy programs
Posted: Sat Sep 17, 2005 1:57 pm
by PB
> ever tried that?
Oops, my mistake. I think I'll keep out of this for now.
