Ticket #2299: ButtonTextJustify2.au3

File ButtonTextJustify2.au3, 2.6 KB (added by anonymous, 10 years ago)

New example of issues

Line 
1#AutoIt3Wrapper_Version=Prod            ; (=beta/prod)
2#include <GUIConstantsEx.au3>
3#include <WindowsConstants.au3>
4#include <ButtonConstants.au3>
5
6
7Global $width=700, $height=580
8Global $styles[4][2] = [[0, "Default"], [$BS_LEFT, "Left"], [$BS_CENTER, "Center"], [$BS_RIGHT, "Right"] ]
9
10
11_Main()
12
13Func _Main()
14
15    Local $msg, $ids
16
17    GUICreate("Demo", $width, $height, 50, 10, $WS_POPUP+$WS_SYSMENU)
18    GUISetBkColor(0x000000)
19    GUISetFont (10, 500)
20
21    $ids = CreateButtons (False, False, "Create",                                       "Correct")
22    $ids = CreateButtons (False, True,  "Create; SetColour",                            "Left/Right wrong 3.3.8.1;     Center/Right wrong 3.3.12.0/3.3.13.19")
23    $ids = CreateButtons (True, False,  "Create; ChangeStyle",                          "Correct")
24    $ids = CreateButtons (True, True,   "Create; ChangeStyle; SetColour",               "Left/Right wrong 3.3.8.1;     Center/Right wrong 3.3.12.0/3.3.13.19")
25
26
27    GUICtrlSetDefBkColor(0x004040)
28    GUICtrlSetDefColor(0xFFFFFF)
29    $ids = CreateButtons (False, False, "SetDefColour; Create",                         "Left/Right wrong 3.3.8.1;     Center/Right wrong 3.3.12.0/3.3.13.19")
30    $ids = CreateButtons (False, True,  "SetDefColour; Create; SetColour",              "Left/Right wrong 3.3.8.1;     Center/Right wrong 3.3.12.0/3.3.13.19")
31    $ids = CreateButtons (True, False,  "SetDefColour; Create; ChangeStyle",            "Colours wrong 3.3.8.1/3.3.12.0/3.3.13.19")
32    $ids = CreateButtons (True, True,   "SetDefColour; Create; ChangeStyle; SetColour", "Left/Right wrong 3.3.8.1;     Center/Right wrong 3.3.12.0/3.3.13.19")
33
34
35    GUISetState()
36    $msg = 0
37
38    While $msg <> $GUI_EVENT_CLOSE
39        $msg = GUIGetMsg ()
40        If $msg > 0 Then ExitLoop
41    WEnd
42
43    GUIDelete()
44
45    Exit
46EndFunc   ;==>_Main
47
48
49Func CreateButtons ( $fChgStyle, $fChgColour, $sDesc, $sResult )
50
51    Local $gx=8, $dx=Int($width/UBound($styles)),  $bw=$dx-2*$gx
52    Local $gy=3, $dy=Int($height/8), $bh=Int (($dy-5*$gy)/3)
53    Local $ids[4]
54    Static $y=0
55
56    $y += $gy*2
57    GUICtrlCreateButton ( $sDesc & @LF & $sResult, $gx, $y, $width-2*$gx, 2*$bh, $BS_MULTILINE )
58    GUICtrlSetBkColor ( -1, 0x000000 )
59    GUICtrlSetColor   ( -1, 0xffffff )
60
61    $y += 2*$bh+$gy
62    For $i = 0 To UBound($styles)-1
63        $ids[$i] = GUICtrlCreateButton ( $styles[$i][1],  $gx+$i*$dx, $y, $bw, $bh, $styles[$i][0] )
64        If $fChgStyle  Then GUICtrlSetStyle   ( $ids[$i], $Styles[$i][0] )
65        If $fChgColour Then GUICtrlSetBkColor ( $ids[$i], 0x005020 )
66    Next
67
68    $y += $bh+$gy*2
69EndFunc   ;==>CreateButtons