Jump to content

Menu Calendar


Recommended Posts

I am attempting to build a menu calendar (just the years).

This is what I have done so far but something tells me it in the wrong direction.

For instance after clicking on a particular year how do I get it referenced for whatever it is needed.

Some kind of array set up?  I tried an array but apparently didn't get it right.

So how would I be able to reference any particular year? Indexed?  But how?

Or start all over?

Thanks

Hobbyist

#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$main = GUICreate("Test Screen", 680, 515, 150, 100)
Local $idViewReport = GUICtrlCreateMenu("&Calendar")
local $viewScreen = GUICtrlCreateMenuItem("Choose Year",  $idViewReport)
Local $date

for $i = -1 to 11
    $date = StringTrimRight(_NowCalc() ,15)+$i

 $viewScreen =  GUICtrlCreateMenuItem($date,$idViewReport)

next


GUISetState(@SW_SHOW)



While 1

        $iMsg = GUIGetMsg()
         Switch $iMsg
             Case $GUI_EVENT_CLOSE
                 Exit

        EndSwitch
WEnd
Link to comment
Share on other sites

You can try it this way (latest beta needed):

 

#AutoIt3Wrapper_Version=b
#include <Date.au3>
#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <WindowsConstants.au3>


$main = GUICreate("Test Screen", 680, 515, 150, 100)
Local $idViewReport = GUICtrlCreateMenu("&Calendar")
Local $hMenu = GUICtrlGetHandle($idViewReport)
local $viewScreen = GUICtrlCreateMenuItem("Choose Year",  $idViewReport)
_GUICtrlMenu_EnableMenuItem($hMenu, 0, 1)
Local $date, $aViewScreen[], $iCtrlID, $iMsg, $i

for $i = 0 to 12
    $date = StringTrimRight(_NowCalc(), 15) + $i - 1
    $iCtrlID = GUICtrlCreateMenuItem($date, $idViewReport)
    $aViewScreen[$iCtrlID] = $date
next

GUISetState(@SW_SHOW)

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            If $aViewScreen.Exists($iMsg) Then MsgBox(0, "Test", $aViewScreen[$iMsg])
    EndSwitch
WEnd

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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