Jump to content

Result of "GUICtrlRead" different of


 Share

Recommended Posts

$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]

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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.
Link to comment
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]

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...