Jump to content



Photo

_GuiCreateGrid()


  • Please log in to reply
9 replies to this topic

#1 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 02 March 2007 - 01:20 AM

Hi to all, i get the idea for this function from this topic, and it seems that this work fine.

AutoIt         
;=============================================================================== ; Function Name:    _GuiCreateGrid() ; Description:      Create grid on the screen, using GUI windows. ; ; Parameter(s):     $GridWidth = The Width of the grid, $GridHeight = The Height of the grid, ;                   $GridLineHeightWidth = This Parametr defines what Width/Height will be of all lines, ;                   $GridRange = Range between each line (Frequency/Interval), $GridColor = The color of grid, ;                   $TopMost = Defines if the grid will have Top Most attribute. ; ; Requirement(s):   AutoIt 3.2.2.0. ; Return Value(s):  If the total number of lines is more then 1024, ;                   or the parameter $GridRange less then 10, then @Error set to 1 and returned "" (empty string). ; Limit(s):         1) Maximum allowed lines in grid is 1024 (because Maximum number of GUI windows is 1024). ;                   2) The grid is limited to 10 pixels range between each line (not less then 10 pixels range). ; ; Author(s):        G.Sandler a.k.a CreatoR (MsCreatoR) ;=============================================================================== Func _GuiCreateGrid($GridWidth=@DesktopWidth, $GridHeight=@DesktopHeight, $GridLineHeightWidth=1, $GridRange=20, $GridColor=Default, $TopMost=0)     If $GridLineHeightWidth < 1 Then $GridLineHeightWidth = 1     Local $LeftLinesNum = Round($GridWidth/$GridRange)     Local $ToptLinesNum = Round($GridHeight/$GridRange)     Local $i, $FirstLinePos, $TopMostStyle = 0, $MainTopPos = Default, $MainLeftPos = Default, $TopLinesAdd = 0, $LeftLinesAdd = 0     If $TopMost = 1 Then $TopMostStyle = 0x00000008     If $GridWidth = @DesktopWidth Then         $MainLeftPos = 0         $LeftLinesAdd += 2     EndIf     If $GridHeight = @DesktopHeight Then         $MainTopPos = 0         $TopLinesAdd += 2     EndIf         If ($LeftLinesNum + $LeftLinesAdd) + ($ToptLinesNum + $TopLinesAdd) >= 1024 Or $GridRange < 10 Then Return SetError(1, 0, "")         $FirstLinePos = (@DesktopWidth/2) - ($GridWidth/2)     For $i = 1 To $LeftLinesNum + $LeftLinesAdd         $CurrentGui = GUICreate("Grid Width", $GridLineHeightWidth, $GridHeight, $FirstLinePos, $MainTopPos, 0x80880000, 0x00000080+$TopMostStyle)         GUISetBkColor($GridColor, $CurrentGui)         GUISetState(@SW_SHOW, $CurrentGui)         $FirstLinePos += $GridRange     Next     $FirstLinePos = (@DesktopHeight/2) - ($GridHeight/2) - $GridRange     For $i = 1 To $ToptLinesNum + $TopLinesAdd         $CurrentGui = GUICreate("Grid Height", $GridWidth, $GridLineHeightWidth, $MainLeftPos, $FirstLinePos, 0x80880000, 0x00000080+$TopMostStyle)         GUISetBkColor($GridColor, $CurrentGui)         GUISetState(@SW_SHOW, $CurrentGui)         $FirstLinePos += $GridRange     Next EndFuncƒo݊÷ Ù8^–)¢µú+­©àz˜±z["±·œjë‰ü±ëbµ«%zË-…éõÒØb³¥•·¯z¼¬–Œ½éߢ¹²}«-r‰©º×«Â¬¶W›RÆ yìZš™^ý¶®¶ˆ­sd†÷D¶W•6WB‚gV÷C·¶W67ÒgV÷C²ÂgV÷CµV—BgV÷C² ¥ôwV”7&VFTw&–B„FW6·F÷v–GF‚ÂFW6·F÷†V–v‡BÂ"Â#R„sƒ2¤–bW'&÷"F†Và ”×6t&÷‚ƒbÂgV÷C´W'&÷"b333²gV÷C²ÂgV÷CµF†W&Rv2âW'&÷"Fò7&VFRF†Rw&–C²Ö†–×VÒÆÆ÷vVBƖæW2–âw&–B—2#BâââgV÷C²fײ5"fײgV÷C´æBF†Rw&–B—2Ɩ֗FVBFò—†VÇ2&ævR&WGvVVâV6‚ƖæR†æ÷BÆW72F†Vâ—†VÇ2&ævR’gV÷C²fײ5"fײ5"fײgV÷C´ô²ÒÒb3c#²U„•BgV÷C² ”W†—@¤VæD–` ¥v†–ÆR •6ÆVWƒ¥tVæ@ ¤gVæ2V—B‚ ”W†—@¤VæDgVæ0

Edited by MsCreatoR, 02 March 2007 - 01:49 AM.

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team






#2 _Kurt

_Kurt

    I can only imagine the world without Autoit (see above)

  • Active Members
  • PipPipPipPipPipPip
  • 865 posts

Posted 02 March 2007 - 01:36 AM

Looks cool. but.. Greed? Don't you mean Grid :whistle:

Kurt

EDIT: pressed the edit button?

Edited by _Kurt, 02 March 2007 - 01:36 AM.

Awaiting Diablo III..

#3 MrCreatoR

MrCreatoR

    Must AutoIt!

  • MVPs
  • 3,241 posts

Posted 02 March 2007 - 01:51 AM

Don't you mean Grid

oops... :whistle:

Thanks, i have changed the first post, but how do i change the name of the topic?
Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

Posted Image AutoIt Russian CommunityPosted Image Projects: ATT - Application Translate Tool [new] | BlockIt - Block files & folders [new] | SIP - Selected Image Preview [new] | SISCABMAN - SciTE Abbreviations Manager [new] | AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramPosted Image UDFs: OnAutoItErrorRegister - Handle AutoIt critical errors [new] | AutoIt Syntax Highlight [new] | Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDFPosted Image Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation DemoLike the examples/UDFs? Please rate the topic (up-right corner of the post header: Rating Posted Image)* === My topics === *

==========================================================Posted Image==========================================================

AutoIt is simple, subtle, elegant. © AutoIt Team


#4 Will66

Will66

    Polymath

  • Active Members
  • PipPipPipPip
  • 202 posts

Posted 02 March 2007 - 04:00 AM

Nice :whistle:

#5 SmOke_N

SmOke_N

    It's not what you know ... It's what you can prove!

  • Moderators
  • 15,729 posts

Posted 02 March 2007 - 05:24 AM

LOL... nice job... very unique.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.


#6 WeMartiansAreFriendly

WeMartiansAreFriendly

    Where's the kaboom?

  • Active Members
  • PipPipPipPipPipPip
  • 1,245 posts

Posted 02 March 2007 - 05:38 AM

very creative.
Posted ImageDon't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()

#7 Kickassjoe

Kickassjoe

    Kickin' Ass And Takin' Names

  • Active Members
  • PipPipPipPipPipPip
  • 430 posts

Posted 30 April 2007 - 03:06 AM

for some reason the grid's lines that are going up and down are a little bit too far down on the y axis...

is there any way I can fix that? here is the source:

AutoIt         
#include <GuiConstants.au3> #include <Grids.au3> HotKeySet("{esc}", "Quit") $Main = GUICreate("Graph", 500, 500) _GuiCreateGrid(250, 250, 2, 10, 0xAA780C, 1) If @error Then     MsgBox(16, "Error!", "There was an error to create the grid; maximum allowed lines in grid is 1024..." & @CR & "And the grid is limited to 10 pixels range between each line (not less then 10 pixels range)" & @CR & @CR & "OK --> EXIT")     Exit EndIf GUISetState(@SW_SHOW, $Main) While 1     $msg = GuiGetMsg()     Select         Case $msg = $GUI_EVENT_CLOSE             ExitLoop                     Case $msg = $XLine[0]             GUIDelete($XLine[0])                 Case Else         ;;;     EndSelect WEnd Func Quit()     Exit EndFunc


and here is a pic of the problem:
grid.JPG
What goes around comes around... Payback's a bitch.

#8 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,199 posts

Posted 02 December 2007 - 12:40 PM

oops... :)

Thanks, i have changed the first post, but how do i change the name of the topic?

When you edit your original post you can change the title etc at the top. It took me a long time to realize that and I even asked Admin if they could change a title for me before I found it.

I think it might be better to say

$CurrentGui = GUICreate("Grid Height", $GridWidth, $GridLineHeightWidth, $MainLeftPos, $FirstLinePos,$WS_POPUP , 0x00000080+$TopMostStyle);0x80880000

I.e. use $WS_POPUP rather than $WS_POPUPWINDOW because then you can have lines which are much narrower.

Edited by martin, 02 December 2007 - 12:45 PM.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#9 Achilles

Achilles

    Achilles == Ichigo

  • Active Members
  • PipPipPipPipPipPip
  • 2,897 posts

Posted 04 December 2007 - 02:43 AM

Cool effect!

#10 MerkurAlex

MerkurAlex

    I live on cookies and AutoIt.

  • Active Members
  • PipPipPipPipPipPip
  • 639 posts

Posted 04 December 2007 - 03:47 AM

Very nice i decided to make transparency on the lines i also added splashtexton saying "Creating grid..." heres my code.
AutoIt         
Func _GuiCreateGrid($GridWidth=@DesktopWidth, $GridHeight=@DesktopHeight, $GridLineHeightWidth=1, $GridRange=20, $GridColor=Default, $TopMost=0,$transparency=255)     splashtexton("","Creating grid...",80,50,-1,-1,1+2)     If $GridLineHeightWidth < 1 Then $GridLineHeightWidth = 1     Local $LeftLinesNum = Round($GridWidth/$GridRange)     Local $ToptLinesNum = Round($GridHeight/$GridRange)     Local $i, $FirstLinePos, $TopMostStyle = 0, $MainTopPos = Default, $MainLeftPos = Default, $TopLinesAdd = 0, $LeftLinesAdd = 0     If $TopMost = 1 Then $TopMostStyle = 0x00000008     If $GridWidth = @DesktopWidth Then         $MainLeftPos = 0         $LeftLinesAdd += 2     EndIf     If $GridHeight = @DesktopHeight Then         $MainTopPos = 0         $TopLinesAdd += 2     EndIf         If ($LeftLinesNum + $LeftLinesAdd) + ($ToptLinesNum + $TopLinesAdd) >= 1024 Or $GridRange < 10 Then Return SetError(1, 0, "")         $FirstLinePos = (@DesktopWidth/2) - ($GridWidth/2)     For $i = 1 To $LeftLinesNum + $LeftLinesAdd         $CurrentGui = GUICreate("Grid Width", $GridLineHeightWidth, $GridHeight, $FirstLinePos, $MainTopPos, 0x80880000, 0x00000080+$TopMostStyle)         GUISetBkColor($GridColor, $CurrentGui)         GUISetState(@SW_SHOW, $CurrentGui)         winsettrans($currentgui,"",$transparency)         $FirstLinePos += $GridRange     Next     $FirstLinePos = (@DesktopHeight/2) - ($GridHeight/2) - $GridRange     For $i = 1 To $ToptLinesNum + $TopLinesAdd         $CurrentGui = GUICreate("Grid Height", $GridWidth, $GridLineHeightWidth, $MainLeftPos, $FirstLinePos, 0x80880000, 0x00000080+$TopMostStyle)         GUISetBkColor($GridColor, $CurrentGui)         GUISetState(@SW_SHOW, $CurrentGui)         winsettrans($currentgui,"",$transparency)         $FirstLinePos += $GridRange     Next     splashoff() EndFunc

Edited by EagleClaw, 04 December 2007 - 03:47 AM.

Larry is a mass murderer?! Posted ImageIt's always the quiet, clean cut, bald guys... Posted Image





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users