Jump to content

Two label to data transfer?


Recommended Posts

  • Moderators

@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 by JLogan3o13

"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!

Link to comment
Share on other sites

You cannot set data for a label this way - only gradually.

GUICtrlSetData($Label1, $var[0])
GUICtrlSetData($Label2, $var[0])

 

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

2 minutes ago, JLogan3o13 said:

maybe more than a 6 word explanation

A lack of language skills but he is trying. :thumbsup:

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Moderators

Then put your labels in an array, and do something like this:

For $sLabel In $aLabels
   GUICtrlSetData($sLabel, $var[0])
Next

 

"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!

Link to comment
Share on other sites

if there is a need for update the Controls often you can use a func for it:

#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 by AutoBert
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...