Jump to content

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


Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

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

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