I am trying to get the cursor position after a mouse click in the Texteditor gadget, I can not seem to get MUI Royale to respond to the mouse click.
I have had a look at the Texteditor example that comes with MUI Royale, but am unable to get it to to work.
Code: Select all
@VERSION 5,2
@REQUIRE "MUIRoyale"
@DISPLAY {Hidden = True}
; ** Handles all incoming events
Function p_MUIFunc(msg)
Switch msg.action
Case "MUIRoyale":
Switch msg.attribute
Case "CloseRequest":
End
Case "MouseObject":
CH=mui.Get("editor","HasChanged")
if CH > 0
CC=mui.Get("editor","CursorX")
CL=mui.Get("editor","CursorY")
mui.Set("Editor","HasChanged",False)
mui.Set("Cursor","Contents"," Line : "..CL.." Column : "..CC)
endif
Case "HasChanged":
CH=mui.Get("editor","HasChanged")
if CH > 0
CC=mui.Get("editor","CursorX")
CL=mui.Get("editor","CursorY")
mui.Set("Editor","HasChanged",False)
mui.Set("Cursor","Contents"," Line : "..CL.." Column : "..CC)
endif
EndSwitch
Case "HideWindow":
mui.Set("app", "iconified", True)
Case "ShowWindow":
mui.Set("app", "iconified", False)
EndSwitch
EndFunction
; dynamically create MUI GUI
mui.CreateGUI([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app" base="SIMPLE" >
<window id = "win" title="TEXTEDITOR" muiid="EDIT" appwindow="true" notify="closerequest; mouseobject">
<vgroup>
<texteditor Id="Editor" Scrollbar="true" Columns="120" Notify="HasChanged" CycleChain="true" Contents="" />
<hgroup>
<string Id="Cursor" Contents=" Line : 0 Column : 0" />
</hgroup>
</vgroup>
</window>
</application>
]])
; listen to these events!
InstallEventHandler({MUIRoyale = p_MUIFunc, HideWindow = p_MUIFunc, ShowWindow = p_MUIFunc})
; main loop!
Repeat
WaitEvent
Forever
Can anyone help.
Thanks