Sign in to follow this  
Followers 0
jerem488

Result of "GUICtrlRead" different of

5 posts in this topic

$Zone_Somme_Maximale = GUICtrlCreateInput("", 539, 31, 60)
If StringInStr(GUICtrlRead($Zone), ",") Then
    $CorrectionVirgule = StringReplace(GUICtrlRead($Zone), ",", ".")
    $Zone = $Correct
EndIf
MsgBox(0,"",$Zone & @CRLF & GUICtrlRead($Zone))

Hi,

I have an input control, and if the user put a float, i must convert the float to point. But when i use the stringreplace function, the result of $Zone is different of GUICtrlRead($Zone)

Why ? ! ! :)

Thanks


Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Share this post


Link to post
Share on other sites



Souldn't this line

$Zone_Somme_Maximale = GUICtrlCreateInput("", 539, 31, 60)

read

$Zone = GUICtrlCreateInput("", 539, 31, 60)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

The result is always different...


Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Share this post


Link to post
Share on other sites

The result is always different...

The code you posted originally is either

a complete mess and it doesn't surprise that that it produces rubbish,

or

you have not posted important parts of your code in which case we can't really help without more information.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

The code you posted originally is either

a complete mess and it doesn't surprise that that it produces rubbish,

or

you have not posted important parts of your code in which case we can't really help without more information.

This is my complete code :) I put some of my code to facilitate... :)

#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <ListviewConstants.au3>
#Include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <UpdownConstants.au3>
#include <EditConstants.au3>

Dim $Sme_ACT2

GUICreate("Calcul proba", 648, 500)
GUISetState()

$Clnes_PA = GUICtrlCreateListView("", 30, 150, 274, 250)
_GUICtrlListView_SetExtendedListViewStyle($Clnes_PA, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EDITLABELS))
GUICtrlSetBkColor($Clnes_PA, $GUI_BKCOLOR_LV_ALTERNATE)

_GUICtrlListView_AddColumn($Clnes_PA, "MS", 60, 2)
_GUICtrlListView_AddColumn($Clnes_PA, "CT", 60, 2)
_GUICtrlListView_AddColumn($Clnes_PA, "GP", 90, 2)
_GUICtrlListView_AddColumn($Clnes_PA, "G", 30, 2)
_GUICtrlListView_AddColumn($Clnes_PA, "P", 30, 2)

$Clnes_PT = GUICtrlCreateListView("", 344, 150, 274, 250)
_GUICtrlListView_SetExtendedListViewStyle($Clnes_PT, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))


_GUICtrlListView_AddColumn($Clnes_PT, "MS", 90, 2)
_GUICtrlListView_AddColumn($Clnes_PT, "CT", 90, 2)
_GUICtrlListView_AddColumn($Clnes_PT, "GP", 90, 2)

$SmdeDeD = GUICtrlCreateCheckbox("Start:", 30, 30)
$Sme_DP = GUICtrlCreateInput("", 140, 31, 50)

$Label_SME_A3 = GUICtrlCreateLabel("Maintenant : ", 45, 78, 100, 12)
$Label_SmeA = GUICtrlCreateLabel("", 130, 78, 40, 12)
$AddSmer = GUICtrlCreateButton("Ajouter", 172, 68, 60, 30)


GUICtrlCreateLabel("Cotation : ", 274, 34)
$CT_S = GUICtrlCreateInput("", 307, 31, 50)

$Btn_CLC_MSE = GUICtrlCreateButton("Calcul ", 274, 68, 162, 30, $BS_MULTILINE)
$Btn_AJT_PRS = GUICtrlCreateButton("Ajouter +", 456, 68, 162, 30, $BS_MULTILINE)

GUICtrlCreateLabel("Mise MAX : ", 459, 34)
$Pourcentage = 4
$Mise_Maximale = Round($Sme_ACT2 * $Pourcentage / 100, 1)
$Zne_MAX = GUICtrlCreateInput("", 539, 31, 60, -1)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $AddSmer
            If GUICtrlRead($Sme_DP) <> "" And GUICtrlRead($Sme_DP) <> "0" Then
                IniWriteSection(@DesktopDir & "\Test.ini", GUICtrlRead($Sme_DP) & "-" & Random(1,3000,1), "")
                GUICtrlSetState($SmdeDeD, $GUI_CHECKED)
                GUICtrlSetState($Sme_DP, $GUI_DISABLE)
                GUICtrlSetState($AddSmer, $GUI_DISABLE)
                GUICtrlSetData($Label_SmeA, GUICtrlRead($Sme_DP))
                GUICtrlSetFont($Label_SmeA, 8.5, 600)
                If $Sme_DP > 0 Then
                    GUICtrlSetColor($Label_SmeA, 0x007F0E)
                ElseIf $Sme_DP = 0 Then
                    GUICtrlSetColor($Label_SmeA, 0x000000)
                Else
                    GUICtrlSetColor($Label_SmeA, 0xFF0000)
                EndIf
            EndIf
        Case $msg = $Btn_AJT_PRS
            If GUICtrlRead($CT_S) <> "" And GUICtrlRead($CT_S) <> "0" And GUICtrlRead($Zne_MAX) <> "" And GUICtrlRead($Zne_MAX) <> "0" Then
                If StringInStr(GUICtrlRead($Zne_MAX), ",") Then
                    $CorrectionVirgule = StringReplace(GUICtrlRead($Zne_MAX), ",", ".")
                EndIf
                MsgBox(0,"yeahh",GUICtrlRead($Zne_MAX))
                $LINE_PRS = GUICtrlCreateListViewItem(GUICtrlRead($Zne_MAX) & "|" & GUICtrlRead($CT_S) & "|" & Round(GUICtrlRead($Zne_MAX) * GUICtrlRead($CT_S), 2), $Clnes_PA)
                GUICtrlSetBkColor($LINE_PRS, 0x0074FF)
                $Derniere_Section = IniReadSectionNames(@DesktopDir & "\Test.ini")
                IniWrite(@DesktopDir & "\Test.ini", $Derniere_Section[$Derniere_Section[0]], GUICtrlRead($Zne_MAX), GUICtrlRead($CT_S))
                GUICtrlSetBkColor($CT_S, 0xFFFFFF)
                GUICtrlSetBkColor($Zne_MAX, 0xFFFFFF)
            Else
                If GUICtrlRead($CT_S) = "" Or GUICtrlRead($CT_S) = 0 Then
                    GUICtrlSetBkColor($CT_S, 0xFF7F7F)
                    GUICtrlSetCursor($CT_S, -1)
                Else
                    GUICtrlSetBkColor($CT_S, 0xFFFFFF)
                EndIf
                If GUICtrlRead($Zne_MAX) = "" Or GUICtrlRead($Zne_MAX) < 0.5 Then
                    GUICtrlSetBkColor($Zne_MAX, 0xFF7F7F)
                Else
                    GUICtrlSetBkColor($Zne_MAX, 0xFFFFFF)
                EndIf
            EndIf
    EndSelect
WEnd
GUIDelete()

Thanks in advance


Qui ose gagneWho Dares Win[left]CyberExploit[/left]

Share this post


Link to post
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
Sign in to follow this  
Followers 0