Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

GUITFLabel UDF


  • Please log in to reply
33 replies to this topic

#1 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 18 June 2009 - 01:08 PM

Hi,

A long time ago i was looking for a way to set color/font for seperate parts inside label control. I even posted a Feature request about this issue, but back then i quickly realized (well, actualy it's Valik ho told me :D ) that this would be almost impossible to do (for my anyway).

But today i found a tricky way to do that - I managed to build a function, that is kind of html-tag parser. It creates a label control for each text data that is wrapped with <font> tag (or not, but then the control is not formatted).

Function Header:

AutoIt         
; #FUNCTION# ==================================================================================================== ; Name...........:  _GUICtrlTFLabel_Create ; Description....:  Creates Text Formatted Label control(s). ; Syntax.........:  _GUICtrlTFLabel_Create($sData, $iLeft, $iTop [, $iWidth = -1 [, $iHeight = -1 [, $nStyle = -1 [, $nExStyle = -1 ]]]]) ; ; Parameters.....:  $sData    - Formatted data. To set formatted data use <font></font> tag for data string. ;                              * This tag supports the following parameters (when used, they *can* be wrapped with quotes): ;                                   Color   - Text *Color* of data between the tags. ;                                   Size    - Text *Size*. ;                                   Weight  - Text *Weight* (the same values as used in GUICtrlSetFont()). ;                                   Attrib  - Text *Attributes* - The same values as used in GUICtrlSetFont(), ;                                                or supported strings combined together: i(talic), u(nderlined), s(trike). ;                                   Name    - Text font *Name* (the same values as used in GUICtrlSetFont()). ;                                   Style   - Label control’s Style (applies for partial data between the tags). ;                                   ExStyle - Label control’s ExStyle (applies for partial data between the tags). ;                                   Cursor  - Label control’s Cursor (can be cursor IDs, or strings, see description for MouseGetCursor). ;                                   Top     - Top position correction (relative to the global $iTop parameter). ;                                             This is designed to avoid text corruption when using different font names/text's size. ; ;                   $iLeft    - Left position (starting point in case when <font> tags are used) of label controls. ;                   $iTop     - Top position of label controls. ;                   $iWidth   - [Optional] Width of label control - Not used when <font> tags found in the data. ;                   $iHeight  - [Optional] Height of label control - Not used when <font> tags found in the data. ;                   $nStyle   - [Optional] (Forced) Style for entire label controls. Can be overridden by local Style parameter. ;                   $nExStyle - [Optional] (Forced) ExStyle for entire label controls. Can be overridden by local ExStyle parameter. ;                   ; Return values..:  Success   - Returns array of identifiers (Control IDs) of new created label controls. ;                   Failure   - Returns 0. ; Author.........:  G.Sandler (a.k.a MrCreatoR) ; Modified.......:  ; Remarks........:  ; Related........:  ; Link...........:  http://www.autoitscript.com/forum/index.php?showtopic=96986 ; Example........:  Yes. ; ===============================================================================================================


Example - Formatted Labels Editor:

AutoIt         
#include <GUIConstantsEx.au3> #include <GUIEdit.au3> #include <ComboConstants.au3> #include <WindowsConstants.au3> #include "GUITFLabel.au3" Global $iEdit_Changed = 0, $aLabel_Ctrls $hGUI = GUICreate("Formatted Labels Editor", 650, 400) #Region Formate text panel GUICtrlCreateLabel("Size:", 10, 8, -1, 15) $nSize_Combo = GUICtrlCreateCombo("", 40, 5, 55, 20, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "None|8|8.5|9|10|11|12|14|16|18|20|22|24|26|28|36|48|72", "None") GUICtrlCreateLabel("Weight:", 100, 8, -1, 15) $nWeight_Combo = GUICtrlCreateCombo("", 140, 5, 55, 20, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "None|200|400|600|800|1000", "None") GUICtrlCreateLabel("Attrib:", 10, 33, -1, 15) $nAttrib_Combo = GUICtrlCreateCombo("", 40, 30, 155, 20, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "None|italic|underlined|strike|italic+underlined+strike|italic+underlined|italic+strike|underlined+strike", "None") GUICtrlCreateLabel("Name:", 230, 15, 50, 15) $nName_Combo = GUICtrlCreateCombo("", 230, 30, 160, 20, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "None|Arial|Comic Sans Ms|Tahoma|Times|Georgia|Lucida Sans Unicode|Verdana|Times New Roman|Courier New", "None") GUICtrlCreateLabel("Color:", 400, 15, 50, 15) $nColor_Combo = GUICtrlCreateCombo("", 400, 30, 60, 20, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "None|Red|Green|Blue|Yellow|Orange|Gray|Brown|White", "None") GUICtrlCreateLabel("Bk Color:", 470, 15, 50, 15) $nBkColor_Combo = GUICtrlCreateCombo("", 470, 30, 60, 20, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "None|Red|Green|Blue|Yellow|Orange|Gray|Brown|White", "None") GUICtrlCreateLabel("Cursor:", 540, 15, 50, 15) $nCursor_Combo = GUICtrlCreateCombo("", 540, 30, 100, 20, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "None|POINTING|APPSTARTING|ARROW|CROSS|HELP|IBEAM|ICON|NO|SIZE|SIZEALL|SIZENESW|SIZENS|SIZENWSE|SIZEWE|UPARROW|WAIT|HAND", "None") #EndRegion Formate text panel GUICtrlCreateGroup("Select text and then select the formatting parameters from the above panel:", 10, 60, 630, 150) $nSrcText_Edit = GUICtrlCreateEdit("", 20, 80, 610, 120, $ES_NOHIDESEL) ;GUICtrlCreateLabel("Original text:", 20, 75, -1, 15) ;$nSrcText_Edit = GUICtrlCreateEdit("", 20, 90, 610, 40, $ES_NOHIDESEL) ;GUICtrlCreateLabel("Formatted text:", 20, 140, -1, 15) ;$nFormattedText_Edit = GUICtrlCreateEdit("", 20, 155, 610, 40, BitOR($ES_NOHIDESEL, $ES_READONLY)) GUICtrlCreateGroup("Preview:", 10, 230, 630, 130) GUICtrlSetFont(-1, 10, 800) $nClose_Button = GUICtrlCreateButton("Close", 10, 370, 60, 20) $nCopy_Button = GUICtrlCreateButton("Copy", 90, 370, 60, 20) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW, $hGUI) While 1     $nMsg = GUIGetMsg()         Switch $nMsg         Case $GUI_EVENT_CLOSE, $nClose_Button             Exit         Case $nSize_Combo, $nWeight_Combo, $nAttrib_Combo, $nName_Combo, $nColor_Combo, $nBkColor_Combo, $nCursor_Combo             Local $sParam = StringLower(StringRegExpReplace(GUICtrlRead($nMsg - 1), 'h+|:', ''))             Local $sValue = GUICtrlRead($nMsg)                         _SetFormattedText_Proc($sParam, $sValue)         Case $nCopy_Button             Local $sText = GUICtrlRead($nSrcText_Edit)                         If $sText <> "" Then                 ClipPut($sText)             EndIf     EndSwitch         If $iEdit_Changed Then         $iEdit_Changed = 0                 For $i = 1 To UBound($aLabel_Ctrls)-1             GUICtrlDelete($aLabel_Ctrls[$i])         Next                 $aLabel_Ctrls = _GUICtrlCreateTFLabel(GUICtrlRead($nSrcText_Edit), 20, 245, 610, 110)     EndIf WEnd Func _SetFormattedText_Proc($sParam, $sValue)     If $sParam = "attrib" And Not StringRegExp($sValue, '(?i)A(None)?z') Then         $aSplit = StringSplit($sValue, "+")         $sValue = ""                 For $i = 1 To $aSplit[0]             $sValue &= StringLeft($aSplit[$i], 1)                         If $i < $aSplit[0] Then                 $sValue &= "+"             EndIf         Next     EndIf         Local $sSelectionData = ControlCommand($hGUI, "", $nSrcText_Edit, "GetSelected")     Local $sAddParamValue = ' ' & $sParam & '="' & $sValue & '"'         If $sSelectionData = '' Then         Return     EndIf         If StringRegExp($sSelectionData, '(?i)<font.*>.*</font>') Then         $sSelectionData = StringRegExpReplace($sSelectionData, '(?i)(<font.*)( ' & $sParam & '=".*?")(.*>.*</font>)', '13')                 If Not StringRegExp($sValue, '(?i)A(None)?z') Then             $sSelectionData = StringRegExpReplace($sSelectionData, '(?i)(<font.*)(>.*</font>)', '1' & $sAddParamValue & '2')         EndIf                 If StringRegExp($sSelectionData, '(?i)<fonth*>.*</font>') Then             $sSelectionData = StringRegExpReplace($sSelectionData, '(?i)<font.*>(.*)</font>', '1')         EndIf     ElseIf $sAddParamValue <> '' Then         $sSelectionData = '<font' & $sAddParamValue & '>' & $sSelectionData & '</font>'     EndIf         _GUICtrlEdit_ReplaceSel($nSrcText_Edit, $sSelectionData)     Local $iStart = StringInStr(GUICtrlRead($nSrcText_Edit), $sSelectionData)-1     Local $iEnd = $iStart + StringLen($sSelectionData)     GUICtrlSendMsg($nSrcText_Edit, $EM_SETSEL, $iStart, $iEnd) EndFunc Func WM_COMMAND($hWnd, $nMsg, $wParam, $lParam)     Local $nNotifyCode = BitShift($wParam, 16)     Local $nID = BitAND($wParam, 0xFFFF)     Local $hCtrl = $lParam         Switch $nID         Case $nSrcText_Edit             Switch $nNotifyCode                 Case $EN_CHANGE, $EN_UPDATE                     $iEdit_Changed = 1             EndSwitch     EndSwitch         Return $GUI_RUNDEFMSG EndFunc


Screenshots:
Spoiler


History version:
Spoiler


Attachments:
v1.5 Attached File  GUITFLabel_UDF.zip   11KB   483 downloads
v1.4 Attached File  _GUICtrlCreateTFLabel_UDF.zip   10.33KB   368 downloads
v1.3 Attached File  _GUICtrlCreateTFLabel_UDF.zip   8.75KB   464 downloads
v1.2 Attached File  _GUICtrlCreateTFLabel_UDF.zip   5.69KB   473 downloads(Edited version - Previous downloads: 3 :D)
v1.1 Attached File  _GUICtrlCreateTFLabel_UDF.zip   5.28KB   332 downloads
v1.0 Attached File  _GUICtrlCreateTFLabel_UDF.zip   2.72KB   362 downloads

Edited by MrCreatoR, 03 June 2012 - 06:28 PM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team








#2 KenNichols

KenNichols

    Adventurer

  • Active Members
  • PipPip
  • 121 posts

Posted 18 June 2009 - 01:42 PM

Nice work!

#3 billthecreator

billthecreator

    I am The creator

  • Active Members
  • PipPipPipPipPipPip
  • 379 posts

Posted 18 June 2009 - 02:15 PM

thats really cool. nice job.
My Scripts: From Most recent to least.Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

#4 ValeryVal

ValeryVal

    Dig the way

  • Active Members
  • PipPipPipPipPipPip
  • 463 posts

Posted 18 June 2009 - 02:56 PM

Fine.

If so then now you can write AutoLynx.
The point of world view

#5 Ashalshaikh

Ashalshaikh

    Wayfarer

  • Active Members
  • Pip
  • 97 posts

Posted 18 June 2009 - 03:54 PM

Nice Work ..
Thank You !!
:D :D

#6 James

James

    Universalist

  • MVPs
  • 10,353 posts

Posted 18 June 2009 - 04:35 PM

Wow that's awesome!

#7 billthecreator

billthecreator

    I am The creator

  • Active Members
  • PipPipPipPipPipPip
  • 379 posts

Posted 18 June 2009 - 05:31 PM

you could probably change this so that instead of html tags, it can be done in arrays. like

$labeltext1[2][8] = [["text", "color", "size", "weight", "attrib", "fontname", "style", "exstyle"], _ ["text", "color", "size", "weight", "attrib", "fontname", "style", "exstyle"]]

My Scripts: From Most recent to least.Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

#8 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 18 June 2009 - 07:33 PM

Thanks to all for the feedbacks!

you could probably change this so that instead of html tags, it can be done in arrays.

This exactly idea i used in the first version, but i thought that there is should be more convinient usage method, so the user will not have to create bunch of complicated arrays and pass them to the function.
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#9 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 18 June 2009 - 07:43 PM

Thanks to all for the feedbacks!


This exactly idea i used in the first version, but i thought that there is should be more convinient usage method, so the user will not have to create bunch of complicated arrays and pass them to the function.


Nice one CreatoR

I agree, This concept is easier than the Dim process required to use they array. And the visual use of the "&" makes it clearer too!

$sLabel2_Data = _     '<font top="1">and</font> ' & _     '<font color="0x0000FF" size="9" weight="800">Few</font> ' & _     '<font color="0xFF8000" size="9" weight="800" style="' & BitOr(...etc) & '">&more&</font> ' & _     '<font color="0x000080" size="12" weight="800" top="-2.5" name="Georgia">strings</font> data.'


8)

Posted Image

Clic The Pic!!!


#10 nikink

nikink

    Adventurer

  • Active Members
  • PipPip
  • 136 posts

Posted 19 June 2009 - 03:03 AM

Nice! Can you make it work for Buttons too? :D

#11 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 19 June 2009 - 08:12 AM

Nice! Can you make it work for Buttons too? :D

Only like this perhaps:

AutoIt         
#include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUICtrlCreateTFLabel.au3> ; $hGUI = GUICreate("_GUICtrlCreateTFLabel Example", 300, 200) $a3DfaceColor = DllCall("User32.dll", "int", "GetSysColor", "int", 15) ;$COLOR_3DFACE $n3DfaceColor = BitAND(BitShift(String(Binary($a3DfaceColor[0])), 8), 0xFFFFFF) ;RGB2BGR $sLabel_Data = _     '<font color="0x0000FF" bkcolor="' & $n3DfaceColor & '" size="9" weight="800">My </font>' & _     '<font color="0xFF0000" bkcolor="' & $n3DfaceColor & '" size="9" weight="800">Button</font>' $aLabel_Ctrls = _GUICtrlCreateTFLabel($sLabel_Data, 20, 50) $nButton = GUICtrlCreateButton("", 12, 45, 70, 25, $WS_CLIPSIBLINGS) GUICtrlSetBkColor(-1, $n3DfaceColor) GUISetState(@SW_SHOW, $hGUI) While 1     $nMsg = GUIGetMsg()         Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit         Case $aLabel_Ctrls[1] To $aLabel_Ctrls[$aLabel_Ctrls[0]]             $aCurInfo = GUIGetCursorInfo($hGUI)                         While $aCurInfo[2] = 1                 Sleep(10)                 $aCurInfo = GUIGetCursorInfo($hGUI)             WEnd                         If $aCurInfo[4] = $nMsg Then ControlClick($hGUI, "", $nButton)         Case $nButton             MsgBox(64, 'Title', 'Button pressed')     EndSwitch WEnd

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#12 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 19 June 2009 - 09:39 PM

UDF Updated...

History version:

v1.1
+ Added bkcolor parameter to <font> tag.
+ Added state parameter to <font> tag.
+ Added "string color" recognition to bk/color parameter for <font> tag. Supporting 140 known color strings.
+ Added example with formatted labels on button control.

* Now the parameters in <font> tag do not have to be wrapped with quotes.

v1.0
* First release.


Please see the first post.
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#13 nguyenbason

nguyenbason

    Adventurer

  • Validating
  • PipPip
  • 109 posts

Posted 20 June 2009 - 11:19 AM

Thanks. This is what i need
UnderWorldVN- Just play the way you like it

#14 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 25 June 2009 - 08:30 PM

UDF Updated!

History Version:

v1.2
+ Added "string attribute" recognition to "attrib" parameter for <font> tag.
Supported: i(talic) (2), u(nderlined) (4), s(trike) (8).
+ Added support for html-like colors format (#FF0000) in "color" parameter.
+ The "color" parameter in <font> tag can accept now RGB shortcut color, not just RrGgBb.
+ The "color" parameter in <font> tag can also accept now color with no prefix (# or 0x).

v1.1
+ Added bkcolor parameter to <font> tag.
+ Added state parameter to <font> tag.
+ Added "string color" recognition to bk/color parameter for <font> tag. Supporting 140 known color strings.
+ Added example with formatted labels on button control.

* Now the parameters in <font> tag do not have to be wrapped with quotes.

v1.0
* First release.


Please see the first post.

Edited by MrCreatoR, 26 June 2009 - 12:19 AM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#15 nguyenbason

nguyenbason

    Adventurer

  • Validating
  • PipPip
  • 109 posts

Posted 28 June 2009 - 12:46 PM

How can i read data or change data of these labels? Even how to delete it?

Edit:
I Read and Delete use this:
$label = _GUICtrlCreateTFLabel($sLabel1_Data, 20, 20) While 1     Switch GUIGetMsg()         Case $GUI_EVENT_CLOSE                 For $i = 1 To UBound($label) - 1                     $msg = $msg & "" & GUICtrlRead($label[$i])                 Next                     MsgBox(0,"",$msg)                     ;$label = _GUICtrlCreateTFLabel($sLabel2_Data, 20, 20)                 For $i = 1 To UBound($label) - 1                     GUICtrlDelete($label[$i])                 Next wend


Other problem: I cannot get label transparent with this.

Edited by nguyenbason, 28 June 2009 - 01:23 PM.

UnderWorldVN- Just play the way you like it

#16 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 01 July 2009 - 11:56 AM

I cannot get label transparent with this.

It's should be transparent by default... and you can also use GUICtrlSetBkColor($aLabel[$i], $GUI_BKCOLOR_TRANSPARENT).
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#17 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 13 June 2010 - 12:56 PM

Update!

v1.3
+ Added "cursor" parameter in <font> tag, wich supports numeric IDs and string values (POINTING, ARROW, CROSS, etc.), example:
<font attrib="underlined" cursor="POINTING">Hyperlink</font>
+ Added "Formatted Labels Editor", allows to use the library much easier - now the formatted labels can be generated visualy (thanks to SmOke_N for the idea).
* Fixed wrong charset usage, was causing adding of extra lenght to the formatted labels when using several fonts.
* Now the unformatted label data created with the font that currently used in the GUI (by GUISetFont).
* Cosmetic changes in the code.


Please check the first post.
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#18 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,730 posts

Posted 13 June 2010 - 09:38 PM

Update!



Please check the first post.

I like the edit GUI very much. Good job.

Edit:

Let me offer a suggestion.

Make two edits. One that has the character output, and one that has the normal text that you type. That way you don't have to dig through all the <start><end> stuff while editing.

So:

First edit control would have the text I typed. All options I highlight here and change show up in the second edit control.

Second edit control would have the output for me to copy.

And your label would remain the same showing the text in it's display state.

Edited by SmOke_N, 13 June 2010 - 09:43 PM.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.


#19 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 14 June 2010 - 04:42 PM

I like the edit GUI very much. Good job.

Thanks.

Make two edits. One that has the character output, and one that has the normal text that you type. That way you don't have to dig through all the <start><end> stuff while editing.

So:

First edit control would have the text I typed. All options I highlight here and change show up in the second edit control.

Second edit control would have the output for me to copy.

And your label would remain the same showing the text in it's display state.

To be honest i don't understand the purpose of this, what for we need this?
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#20 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,251 posts

Posted 14 June 2010 - 05:01 PM

P.S
And i am not sure how to realize this...
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users