Posted by member 280260 on 2005-12-13 18:44:32
For the theme I'm working on right now, I'm trying to build a widget capable of copying itself - similar to the DeskIcons in Lock.Solid. Based mostly on xLabel, with xTextEdit for the evar saving and copying code. It looks like this so far:
The problem - when I create a new sticky, I have to do an xTextEdit save of xTextEdit commands - I can't stop xTextEdit from parsing the code I'm asking it to write, so it stops halfway through. I've looked at other people building widgets like this and they all seem to use LUA. Is there any other module I can use to do this, or do I have to learn LUA?
Thanks.
StickyCount 1
*popup "sticky options" !New !PopupSticky
*popup "add sticky" !execute [!xTextReplace @$ConfigDir$sticky.rc@ @^StickyCount@ @StickyCount $StickyCount+1$@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!xTextAppend @$ConfigDir$sticky.rc@ @*Label Sticky$StickyCount+1$@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$Width 200@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$Height 200@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$X 0@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$Y 0@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$AddToGroup Sticky@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!Recycle]
*popup ~new
StickyImage sticky.png
StickyAlphaTransparency 190
StickyMoveable
StickyMoveModifierKey ".none"
StickyBorders 5
StickyResizeBorder 3
StickyTextEditBox 5 5 90 #h
StickyAutoLineBreak
StickyAutoMinHeight 100
StickyAutoMinWidth 100
StickyFont "Century Gothic"
StickyFontHeight 21
StickyFontVertAlign "center"
StickyFontAlign "center"
StickyOnRightClick !PopupSticky
;--------------------------------------
*Label Sticky1
Sticky1Width 145
Sticky1Height 131
Sticky1X 70
Sticky1Y 205
Sticky1AddToGroup Sticky
Sticky1Text "Call Rachael!"
Sticky1OnLeftDoubleClick !ParseEvars !Execute [!LabelSetText Sticky1 " "] [!LabelSetText Sticky1 ".editbox" ""] [!LabelShow Sticky1 ".editbox"]
Sticky1TextEditBoxOnUnfocus !LabelHide Sticky1 ".editbox"
Sticky1OnMove !ParseEvars !execute [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1X@ @Sticky1X %#Sticky1currentx%#@][!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Y@ @Sticky1Y %#Sticky1currenty%#@]
Sticky1TextEditBoxEnterAction !ParseEvars !execute [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Text@ @Sticky1Text "%[textinput]%"@] [!LabelSetText Sticky1 "%[textinput]%"] [!LabelHide Sticky1 ".editbox"]
Sticky1OnResize !ParseEvars !Execute [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Width@ @Sticky1Width %#Sticky1currentwidth%#@] [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Height@ @Sticky1Height %#Sticky1currentheight%#@]
*popup "sticky options" !New !PopupSticky
*popup "add sticky" !execute [!xTextReplace @$ConfigDir$sticky.rc@ @^StickyCount@ @StickyCount $StickyCount+1$@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!xTextAppend @$ConfigDir$sticky.rc@ @*Label Sticky$StickyCount+1$@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$Width 200@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$Height 200@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$X 0@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$Y 0@][!xTextAppend @$ConfigDir$sticky.rc@ @Sticky$StickyCount+1$AddToGroup Sticky@][!xTextAppend @$ConfigDir$sticky.rc@ @@][!Recycle]
*popup ~new
StickyImage sticky.png
StickyAlphaTransparency 190
StickyMoveable
StickyMoveModifierKey ".none"
StickyBorders 5
StickyResizeBorder 3
StickyTextEditBox 5 5 90 #h
StickyAutoLineBreak
StickyAutoMinHeight 100
StickyAutoMinWidth 100
StickyFont "Century Gothic"
StickyFontHeight 21
StickyFontVertAlign "center"
StickyFontAlign "center"
StickyOnRightClick !PopupSticky
;--------------------------------------
*Label Sticky1
Sticky1Width 145
Sticky1Height 131
Sticky1X 70
Sticky1Y 205
Sticky1AddToGroup Sticky
Sticky1Text "Call Rachael!"
Sticky1OnLeftDoubleClick !ParseEvars !Execute [!LabelSetText Sticky1 " "] [!LabelSetText Sticky1 ".editbox" ""] [!LabelShow Sticky1 ".editbox"]
Sticky1TextEditBoxOnUnfocus !LabelHide Sticky1 ".editbox"
Sticky1OnMove !ParseEvars !execute [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1X@ @Sticky1X %#Sticky1currentx%#@][!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Y@ @Sticky1Y %#Sticky1currenty%#@]
Sticky1TextEditBoxEnterAction !ParseEvars !execute [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Text@ @Sticky1Text "%[textinput]%"@] [!LabelSetText Sticky1 "%[textinput]%"] [!LabelHide Sticky1 ".editbox"]
Sticky1OnResize !ParseEvars !Execute [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Width@ @Sticky1Width %#Sticky1currentwidth%#@] [!xTextReplace @$ConfigDir$sticky.rc@ @^Sticky1Height@ @Sticky1Height %#Sticky1currentheight%#@]
The problem - when I create a new sticky, I have to do an xTextEdit save of xTextEdit commands - I can't stop xTextEdit from parsing the code I'm asking it to write, so it stops halfway through. I've looked at other people building widgets like this and they all seem to use LUA. Is there any other module I can use to do this, or do I have to learn LUA?
Thanks.