youtuber Posted May 28, 2016 Posted May 28, 2016 Hi, How to transfer data two labels? GUICtrlSetData($Label1,$Label2, $var[0])
Moderators JLogan3o13 Posted May 28, 2016 Moderators Posted May 28, 2016 (edited) @youtuber, if you're trying to set the value of a label, you would do so like this. If you are looking to do something else, maybe more than a 6 word explanation GUICtrlSetData($label1, $var[0]) GUICtrlSetData($label2, $var[0]) Edited May 28, 2016 by JLogan3o13 youtuber 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
UEZ Posted May 28, 2016 Posted May 28, 2016 You cannot set data for a label this way - only gradually. GUICtrlSetData($Label1, $var[0]) GUICtrlSetData($Label2, $var[0]) youtuber 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
UEZ Posted May 28, 2016 Posted May 28, 2016 2 minutes ago, JLogan3o13 said: maybe more than a 6 word explanation A lack of language skills but he is trying. youtuber and JLogan3o13 2 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
youtuber Posted May 28, 2016 Author Posted May 28, 2016 I've got my 4 label Is it not a bit more code pollution? GUICtrlSetData($Label1, $var[0]) GUICtrlSetData($Label2, $var[0]) GUICtrlSetData($Label3, $var[0]) GUICtrlSetData($Label4, $var[0]) I want a shorter code
Moderators JLogan3o13 Posted May 28, 2016 Moderators Posted May 28, 2016 Then put your labels in an array, and do something like this: For $sLabel In $aLabels GUICtrlSetData($sLabel, $var[0]) Next youtuber 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
AutoBert Posted May 29, 2016 Posted May 29, 2016 (edited) if there is a need for update the Controls often you can use a func for it: expandcollapse popup#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <WinAPI.au3> $hGui = GUICreate("_SetProgress Test", 300, 125, 302, 218) $idprgInfo = GUICtrlCreateProgress(8, 70, 285, 30) $idlblInfo2 = GUICtrlCreateLabel("0", 8, 20, 285, 25, $ES_CENTER) $hGUI_c = GUICreate("", 184, 30, 8, 73, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TRANSPARENT, $WS_EX_MDICHILD), $hGui) GUISetBkColor(0x989898, $hGUI_c) $idlblInfo = GUICtrlCreateLabel("0", 0, 0, 184, 25, $ES_CENTER) GUICtrlSetFont(-1, 12, 1000) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) _WinAPI_SetLayeredWindowAttributes($hGUI_c, 0x989898) GUISetState(@SW_SHOW, $hGui) GUISetState(@SW_SHOWNA, $hGUI_c) $sUpdateIDs=$idprgInfo&'|'&$idlblInfo&'|'&$idlblInfo2 ;string with all IDs needing update the progress, separated with "|" For $i=1 to 90000 _SetProgress($i/1000,$sUpdateIDs,0) ;Sleep(Random(10,30,1)) Next Sleep(5000) _SetProgress(100,$sUpdateIDs) Sleep(2000) Func _SetProgress($nPercent,$sIDs,$iDecPlaces=2) ;for updating several Controls ;params: $nPercent ; $sIDs string with all IDs needing update the progress, separated with "|" ; $iDecPlaces [optional] Integer indicating how many places to the right of the decimal are be shown. If omitted, Round there are 2 decimalplaces shown. ;author autobert Local Static $nOld Local $nNew=Round($nPercent,$iDecPlaces) if $nNew=$nOld Then Return ;to avoid heavy flickr $nOld=$nNew $aIDs=StringSplit($sIDs,'|') For $x=1 To $aIDs[0] GUICtrlSetData($aIDs[$x], StringFormat('%10.8s %',$nNew)) Next EndFunc Edited May 29, 2016 by AutoBert
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now