10031992 Posted March 13, 2011 Posted March 13, 2011 Hello. Anyone know how to show me that shows the person's age, according to her place in the camps (day / month / year) it makes the sum and show in the "Input", below, the person's age, according as it is in the code below, if possible if you can explain all the content shown be very grateful. #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 259, 233, 323, 268) $Group1 = GUICtrlCreateGroup("", 16, 24, 225, 185) $Label1 = GUICtrlCreateLabel("Date of birth:", 32, 72, 79, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateCombo("", 32, 96, 49, 25) GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|23|22|23|24|25|26|27|28|29|30|31") GUICtrlCreateCombo("", 96, 96, 49, 25) GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12") $Age = GUICtrlCreateInput("", 160, 96, 65, 21) $Label2 = GUICtrlCreateLabel("Age:", 32, 136, 30, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("", 96, 160, 65, 21) GUICtrlSetState($Input1,$GUI_DISABLE) $Label3 = GUICtrlCreateLabel("You have", 40, 163, 50, 17) $Label4 = GUICtrlCreateLabel("years", 176, 163, 29, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I asked a friend if he could show me that, this formula, but he did not know Att. JCaram -------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program
Moderators Melba23 Posted March 13, 2011 Moderators Posted March 13, 2011 10031992, One way to do it: expandcollapse popup#include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <Date.au3> $Form1 = GUICreate("Form1", 259, 233, 323, 268) $Group1 = GUICtrlCreateGroup("", 16, 24, 225, 185) $Label1 = GUICtrlCreateLabel("Date of birth:", 32, 72, 79, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $hCombo_Day = GUICtrlCreateCombo("", 32, 96, 49, 25) GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|23|22|23|24|25|26|27|28|29|30|31") $hCombo_Mon = GUICtrlCreateCombo("", 96, 96, 49, 25) GUICtrlSetData(-1, "01|02|03|04|05|06|07|08|09|10|11|12") $hYear = GUICtrlCreateInput("", 160, 96, 65, 21) $Label2 = GUICtrlCreateLabel("Age:", 32, 136, 30, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Input1 = GUICtrlCreateInput("", 96, 160, 65, 21) GUICtrlSetState($Input1, $GUI_DISABLE) $Label3 = GUICtrlCreateLabel("You have", 40, 163, 50, 17) $Label4 = GUICtrlCreateLabel("years", 176, 163, 29, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If GUICtrlRead($hCombo_Day) And GUICtrlRead($hCombo_Mon) And Number(GUICtrlRead($hYear)) > 1000 Then $sAge = _DateDiff("Y", GUICtrlRead($hYear) & "/" & GUICtrlRead($hCombo_Mon) & "/" & GUICtrlRead($hCombo_Day), @YEAR & "/" & @MON & "/" & @MDAY) If Not GUICtrlRead($Input1) Then GUICtrlSetData($Input1, $sAge) Else GUICtrlSetData($Input1, "") EndIf WEnd Please ask if you have any questions. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
AutoBert Posted March 13, 2011 Posted March 13, 2011 Hello Melba, just change Line #37 to If GUICtrlRead($Input1) <> $sAge Then GUICtrlSetData($Input1, $sAge) and the age is also correct, when the date (month or Year) is changed, mfg autoBert
10031992 Posted March 13, 2011 Author Posted March 13, 2011 Just do not understand this function "_DataDiff" did not know, other script took longer i able to understand Thanks everybody -------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program
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