Sign in to follow this  
Followers 0
10031992

shows the age the sum by the day and month and current year

4 posts in this topic

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

Share this post


Link to post
Share on other sites



10031992,

One way to do it: :)

#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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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