MikelSevrel Posted March 7, 2006 Posted March 7, 2006 (edited) I've been everywhere, and I cannot figure out if there is a way to draw a grid suitable for a calendar. I've looked at some other apps, like the Sodoku scripts, but I don't understand how they actually render the grid. Any help would be appreciated. I just need to figure out how to make a 6x7 grid, and I can't do it. Edited March 7, 2006 by MikelSevrel Coming soon....
greenmachine Posted March 7, 2006 Posted March 7, 2006 You could use GUICtrlCreateMonthCal.... Another option would be a graphic control and lines.
rakudave Posted March 7, 2006 Posted March 7, 2006 something like: #include <GUIConstants.au3> Global $grid[7][8] GUICreate("my gui",400,450,-1,-1) for $x = 1 to 6 for $y = 1 to 7 $grid[$x][$y] = GUICtrlCreateInput("",$x * 50, $y * 50,50,50) next next GUISetState() do $msg = GUIGetMsg() until $msg = $GUI_EVENT_CLOSE Pangaea Ruler new, UDF: _GUICtrlCreateContainer(), Pangaea Desktops, Pangaea Notepad, SuDoku, UDF: Table
pecloe Posted March 7, 2006 Posted March 7, 2006 (edited) $guititle = "test gui" $GUIHANDLE = GUICreate($guititle,400,400) For $X = 20 to 380 Step 20 GUICtrlCreateLabel("", 0, $X, 400, 2) GUICtrlSetBkColor(-1, 0x000000) Next For $X = 20 to 380 Step 20 GUICtrlCreateLabel("", $X, 0, 2, 400) GUICtrlSetBkColor(-1, 0x000000) Next GUISetState(@SW_SHOW, $GUIHANDLE) While 1 $m = GUIGetMsg() Select Case $m = $gui_event_close Exit EndSelect WEnd i'm sure there's better ways, might give you an ides Edited March 7, 2006 by pecloe
MikelSevrel Posted March 7, 2006 Author Posted March 7, 2006 Thanks, those scripts work great. Coming soon....
MikelSevrel Posted March 7, 2006 Author Posted March 7, 2006 Now the pronblem is getting the informatioon into the input boxes. Can someone take a look at this and tell me what i'm doing wrong? expandcollapse popup;rakudave #include <GUIConstants.au3> #include <Date.au3> #include <Array.au3> Global $grid[7][8] Dim $num = 1 GUICreate("my gui", 450, 400, -1, -1) $month = @MON $year = @YEAR For $x = 1 To 7 For $y = 1 To 6 $grid[$y][$x] = GUICtrlCreateInput("", $x * 50, $y * 50, 50, 50, $ES_READONLY) Next Next $daysinmonth = _DateDaysInMonth($year, $month) $days = _DateToDayOfWeek($year, $month, 1) For $i = 1 To $days GUICtrlSetData($grid[1][$days], $num) $num = $num + 1 If $num >= $daysinmonth Then ExitLoop Next For $d = 2 To 6 For $i = 1 To 7 GUICtrlSetData($grid[$d][$i], $num) $num = $num + 1 If $num >= $daysinmonth Then ExitLoop Next If $num >= $daysinmonth Then ExitLoop Next GUISetState() Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Coming soon....
MikelSevrel Posted March 8, 2006 Author Posted March 8, 2006 (edited) Is there any way to make this read only, while still keeping the borders the same? expandcollapse popup;;rakudave #include <GUIConstants.au3> #include <Date.au3> #include <Array.au3> Global $grid[7][8] Dim $num = 1 GUICreate("my gui", 450, 400, -1, -1) $month = @MON $year = @YEAR For $x = 1 To 7 For $y = 1 To 6 $grid[$y][$x] = GUICtrlCreateEdit("", $x * 50, $y * 50, 50, 50, $ES_READONLY, $ES_MULTILINE) GUICtrlSetBkColor($grid[$y][$x], 0xFFFFFF) Next Next $daysinmonth = _DateDaysInMonth($year, $month) $days = _DateToDayOfWeek($year, $month, 1) For $i = 1 To $days GUICtrlSetData($grid[1][$days], $num) GUICtrlSetBkColor($grid[1][$days], 0xDDDDDD) GUICtrlSetStyle ($grid[1][$days],$WS_DLGFRAME,$ES_READONLY) If $num = @MDAY Then GUICtrlSetBkColor($grid[1][$days], 0xEEEEEE) If $num = @MDAY Then GUICtrlSetData($grid[1][$days], $num & @CRLF & @CRLF & " Today") $num = $num + 1 $days = $days + 1 If $num >= $daysinmonth Then ExitLoop Next For $d = 2 To 6 For $i = 1 To 7 GUICtrlSetData($grid[$d][$i], $num) GUICtrlSetBkColor($grid[$d][$i], 0xDDDDDD) GUICtrlSetStyle($grid[$d][$i],$WS_DLGFRAME) If $num = @MDAY Then GUICtrlSetBkColor($grid[$d][$i], 0xEEEEEE) If $num = @MDAY Then GUICtrlSetData($grid[$d][$i], $num & @CRLF & @CRLF & " Today") $num = $num + 1 If $num >= $daysinmonth Then ExitLoop Next If $num >= $daysinmonth Then ExitLoop Next GUISetState() Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Edited March 8, 2006 by MikelSevrel Coming soon....
tonedeaf Posted March 8, 2006 Posted March 8, 2006 WS_DLGFRAME, $ES_READONLY are common styles. Use BitOr() to combine styles.Change these lines:GUICtrlSetStyle ($grid[1][$days],$WS_DLGFRAME,$ES_READONLY) GUICtrlSetStyle($grid[$d][$i],$WS_DLGFRAME)to:GUICtrlSetStyle ($grid[1][$days], BitOr($WS_DLGFRAME,$ES_READONLY)) GUICtrlSetStyle ($grid[$d][$i], BitOr($WS_DLGFRAME,$ES_READONLY))
MikelSevrel Posted March 8, 2006 Author Posted March 8, 2006 Ahh, thank you very much. Coming soon....
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