Page 1 sur 1

[..] Problème d'ajout de produit

Posté : mar. 31 janv. 2017 16:20
par 9aylas
salut a tous j'ai un ptit probleme
regarder le code
j'ai pas pu ajouter tout les info sur l'Edit :cry:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Manager", 373, 281, 361, 120)
GUISetBkColor(0x000000)
$produit = GUICtrlCreateInput("Nom Du Produit", 8, 8, 137, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$prix = GUICtrlCreateInput("Prix De Vente", 144, 8, 89, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_NUMBER,$WS_BORDER))
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x008000)
$date = GUICtrlCreateInput("Date", 240, 8, 65, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetColor(-1, 0x000080)
$add = GUICtrlCreateButton("Ajouter", 312, 8, 57, 129)
$Button2 = GUICtrlCreateButton("Exit", 312, 144, 57, 129)

$Edit1 = GUICtrlCreateEdit("", 8, 32, 297, 241, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
   $nMsg = GUIGetMsg()
   Switch $nMsg
   
 Case $add
   $info= GUICtrlRead($produit)
   GUICtrlSetData($Edit1, $info)
 Case $GUI_EVENT_CLOSE
 Exit
 Case $Button2
 Exit
   Case $Form1
   EndSwitch
WEnd

Re: [..] problem d'ajout de produit

Posté : mar. 31 janv. 2017 16:56
par parazitenew
Bonjour,
$info= GUICtrlRead($produit)
    GUICtrlSetData($Edit1, $info)
Ceci explique ton problème. Tu ne fais qu'insérer ce qui est saisie dans le champ produit. Si tu veux afficher le prix et la date aussi, alors il faut procéder de la même manière, à savoir lire et mettre dans des variables le contenu des autres inputs.

Re: [..] problem d'ajout de produit

Posté : mar. 31 janv. 2017 17:21
par 9aylas
sa marche pas , quand j'ajoute les autre variables , rien est affiché sur l'Edit

Re: [..] problem d'ajout de produit

Posté : mar. 31 janv. 2017 19:04
par Nicoloquinte
Heu Je crois que j'ai compris :mrgreen:
Mais tu n'avait pas formulé cela dans ta question au début

Mais du coup j'ai fait tout ton boulot ....................... :mrgreen:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <WindowsConstants.au3>


$Aff = ""
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Manager", 373, 281, 361, 120)
GUISetBkColor(0x000000)
$produit = GUICtrlCreateInput("Nom Du Produit", 8, 8, 137, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$WS_BORDER))
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$prix = GUICtrlCreateInput("Prix De Vente", 144, 8, 89, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_NUMBER,$WS_BORDER))
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x008000)
$date = GUICtrlCreateInput("Date", 240, 8, 65, 21, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetColor(-1, 0x000080)
$add = GUICtrlCreateButton("Ajouter", 312, 8, 57, 129)
$Button2 = GUICtrlCreateButton("Exit", 312, 144, 57, 129)

$Edit1 = GUICtrlCreateEdit("", 8, 32, 297, 241, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

 Case $add
   $Aff =  GUICtrlRead($Edit1)&@CRLF&GUICtrlRead($produit)&"    "&GUICtrlRead($prix)&"   €"&"     "&GUICtrlRead($date)
    GUICtrlSetData($Edit1, $Aff)
 Case $GUI_EVENT_CLOSE
 Exit
 Case $Button2
 Exit
   Case $Form1
   EndSwitch
WEnd

Re: [..] problem d'ajout de produit

Posté : mar. 31 janv. 2017 19:15
par walkson
GUICtrlSetData ( controlID, data [, default] )

controlID The control identifier (controlID) as returned by a GUICtrlCreate...() function, or -1 for the last created control.
data Combo, List, ListView, ListViewItem: An Opt("GUIDataSeparatorChar",...) separated list of items.
Progress: The percentage.
Slider: The value.
Button, Checkbox, Combo, Edit, Group, Input, Label, List, Menu, MenuItem, Radio, TabItem, TreeViewItem: Replaces the text.
Date : The date or time depending the style of the control and the regional settings.
Dummy: The value.
default [optional]
Combo, List: The default value.
Edit, Input: If non-empty (""), the string is inserted at the current insertion point (caret).
Case $add
        $info= GUICtrlRead($produit) & @CRLF
        GUICtrlSetData($Edit1, $info,1)
        $info= GUICtrlRead($prix) & @CRLF
        GUICtrlSetData($Edit1, $info,1)
        $info= GUICtrlRead($date) & @CRLF
        GUICtrlSetData($Edit1, $info,1)
      GUICtrlSetData($Edit1, @CRLF,1)
      ;ou
      $info = GUICtrlRead($produit) &"> "& GUICtrlRead($prix) &"> "& GUICtrlRead($date) & @CRLF
      GUICtrlSetData($Edit1, $info,1)
      GUICtrlSetData($Edit1, @CRLF,1)
      ;ou
      $info= GUICtrlRead($produit) & @TAB
        GUICtrlSetData($Edit1, $info,1)
        $info= GUICtrlRead($prix) & @TAB
        GUICtrlSetData($Edit1, $info,1)
      $info= GUICtrlRead($date) & @CRLF
        GUICtrlSetData($Edit1, $info,1)
:mrgreen:

Re: [..] problem d'ajout de produit

Posté : mar. 31 janv. 2017 19:44
par A2Energie
Bonjour 9aylas,

Pourrais tu revoir certaines choses qui permettent une bonne entente et plus de clareté dans tes posts,

1/ Renommer ton précédent post comme te le demande Tommy : https://www.autoitscript.fr/forum/viewt ... =3&t=14419
2/ Si le précédent post a été résolu l'indiquer : https://www.autoitscript.fr/forum/viewt ... f=35&t=595

Merci a toi et bon codes,

Re: [R] problem d'ajout de produit

Posté : jeu. 02 févr. 2017 16:19
par 9aylas
Ooooh merci a vous a l'infinie <3

c'es bon sa marche & j'ai ajouter de + le boutton enregistrer + éffacer le text mércyyyyyyy