Jump to content
Sign in to follow this  
guinness

GUI design concepts.

Recommended Posts

Here is the GUI I use as base for my 'About' window, enhanced by a perforated logo that I made a long time ago...

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=Gui with perforated image
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=A. greenCan
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <Date.au3>
#include <String.au3>
About("Database SQL")
Exit
#Region Functions
#FUNCTION# ==============================================================
Func About($sTitle)
Local $iWindowWidth = 250, $iWindowHeight = 110, $Msg
$sTitle = _StringRepeat(" ", Int( (($iWindowWidth / 5.9) - StringLen($sTitle))/2)) & $sTitle ; center title
Local $sVersion = FileGetVersion(@ScriptName), $aVersionDate = FileGetTime ( @ScriptName , 1 ,0 )
Local $About = GuiCreate($sTitle, $iWindowWidth, $iWindowHeight, -1,-1,$WS_CAPTION, $WS_EX_TOPMOST)
GuiSetBkColor(0x0000FF)
GuiCtrlCreateLabel("Author: A. GreenCan" & @CR & "Ver " & $sVersion & @CR & _DateToMonth($aVersionDate[1], 1 ) & " " & $aVersionDate[0], ($iWindowWidth-120)/2, 10,120,50)
GUICtrlSetColor (-1, 0xFFFFFF)
GuiCtrlCreateLabel("", 10,55, $iWindowWidth - 20,1) ; white line
GuiCtrlSetBkColor(-1, 0xFFFFFF)
Local $sOK = GUICtrlCreateButton("OK", 10, $iWindowHeight - 40, 70,22, $BS_DEFPUSHBUTTON )
; Perforated Image
Local $iLeftPos = $iWindowWidth - 145
Local $iTopPos = $iWindowHeight - 20
_GuiImageHole($About, $iLeftPos, $iTopPos, 136, 41)
$iBegin = TimerInit()
GUISetState()
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
ExitLoop
Case $Msg = $sOK
ExitLoop
Case TimerDiff($iBegin) > 10000 ; close after 10 sec
ExitLoop
EndSelect
WEnd
GUIDelete($About)
Return
EndFunc ;==>About
#FUNCTION# ==============================================================
#Region Perforated Image
#FUNCTION# ==============================================================
Func _GuiImageHole($window_handle, $pos_x, $pos_y,$Image_Width ,$Image_Height)
    Local $aClassList, $aM_Mask, $aMask, $Block_value
#Region picture array
    Local $PictArray[262] = [ _
'3,1,48,1','50,1,137,1','3,2,48,2','50,2,93,2','94,2,137,2','1,3,2,3','4,3,47,3','49,3,92,3','95,3,137,3','1,4,3,4','5,4,25,4','28,4,46,4','48,4,92,4','95,4,137,4','1,5,3,5','5,5,25,5','29,5,45,5','48,5,92,5','95,5,137,5','1,6,4,6', _
'6,6,24,6','30,6,45,6','47,6,92,6','96,6,137,6','1,7,5,7','7,7,9,7','10,7,23,7','30,7,38,7','42,7,44,7','46,7,93,7','96,7,137,7','1,8,6,8','11,8,24,8','29,8,37,8','45,8,66,8','68,8,93,8','96,8,137,8','1,9,6,9','13,9,24,9','30,9,36,9', _
'44,9,66,9','69,9,87,9','91,9,93,9','97,9,137,9','1,10,6,10','13,10,23,10','31,10,37,10','43,10,65,10','71,10,86,10','92,10,93,10','97,10,137,10','1,11,6,11','12,11,22,11','32,11,35,11','42,11,65,11','71,11,86,11','92,11,93,11','97,11,137,11','1,12,6,12','15,12,22,12', _
'32,12,34,12','43,12,50,12','54,12,65,12','70,12,86,12','97,12,137,12','1,13,5,13','18,13,21,13','32,13,33,13','44,13,49,13','55,13,65,13','72,13,86,13','96,13,137,13','1,14,5,14','15,14,16,14','44,14,48,14','55,14,64,14','73,14,86,14','96,14,137,14','1,15,4,15','15,15,20,15', _
'45,15,48,15','54,15,64,15','74,15,85,15','96,15,137,15','1,16,4,16','17,16,19,16','46,16,48,16','55,16,63,16','75,16,84,16','96,16,137,16','1,17,5,17','17,17,18,17','46,17,47,17','56,17,63,17','76,17,84,17','97,17,137,17','1,18,5,18','17,18,18,18','46,18,47,18','56,18,63,18', _
'77,18,84,18','97,18,137,18','1,19,6,19','16,19,18,19','33,19,34,19','57,19,63,19','77,19,84,19','98,19,137,19','1,20,6,20','16,20,17,20','32,20,34,20','58,20,63,20','77,20,84,20','98,20,137,20','1,21,6,21','16,21,17,21','32,21,34,21','58,21,63,21','78,21,83,21','98,21,137,21', _
'1,22,6,22','32,22,34,22','58,22,63,22','78,22,83,22','98,22,137,22','1,23,6,23','57,23,64,23','78,23,82,23','98,23,137,23','1,24,6,24','57,24,65,24','78,24,82,24','98,24,137,24','1,25,6,25','58,25,65,25','77,25,82,25','99,25,137,25','1,26,6,26','58,26,64,26','76,26,83,26', _
'99,26,137,26','1,27,7,27','32,27,33,27','46,27,47,27','58,27,64,27','77,27,83,27','100,27,137,27','1,28,7,28','31,28,33,28','46,28,47,28','58,28,65,28','77,28,83,28','99,28,137,28','2,29,7,29','31,29,33,29','59,29,65,29','78,29,84,29','98,29,137,29','7,30,8,30','16,30,18,30', _
'31,30,33,30','46,30,47,30','59,30,65,30','79,30,84,30','96,30,137,30','8,31,10,31','15,31,18,31','25,31,26,31','31,31,34,31','45,31,47,31','60,31,62,31','79,31,85,31','95,31,137,31','3,32,6,32','8,32,10,32','15,32,21,32','25,32,26,32','33,32,34,32','42,32,48,32','60,32,62,32', _
'78,32,85,32','95,32,137,32','34,33,35,33','39,33,40,33','42,33,49,33','60,33,62,33','76,33,86,33','95,33,120,33','125,33,130,33','135,33,137,33','38,34,39,34','44,34,51,34','76,34,88,34','95,34,122,34','125,34,129,34','131,34,134,34','135,34,137,34','47,35,51,35','55,35,60,35','64,35,65,35', _
'76,35,88,35','95,35,121,35','123,35,124,35','126,35,128,35','130,35,134,35','135,35,137,35','49,36,51,36','56,36,62,36','65,36,66,36','69,36,70,36','76,36,81,36','83,36,88,36','95,36,120,36','122,36,124,36','126,36,127,36','129,36,137,36','56,37,58,37','66,37,70,37','76,37,78,37','84,37,88,37', _
'95,37,120,37','122,37,124,37','126,37,127,37','129,37,131,37','135,37,137,37','67,38,71,38','77,38,79,38','84,38,89,38','95,38,119,38','126,38,127,38','129,38,132,38','134,38,137,38','32,39,33,39','85,39,89,39','95,39,118,39','120,39,124,39','126,39,127,39','129,39,132,39','134,39,137,39','18,40,24,40', _
'26,40,41,40','86,40,89,40','95,40,117,40','121,40,123,40','127,40,128,40','134,40,137,40','14,41,46,41','85,41,89,41','95,41,137,41','9,42,52,42','88,42,89,42','97,42,137,42','7,43,55,43','57,43,59,43','62,43,65,43','67,43,69,43','70,43,73,43','100,43,137,43','6,44,79,44','100,44,137,44', _
'4,45,81,45','100,45,137,45']
#EndRegion picture array
; get the size of the active window
Local $size = WinGetClientSize($window_handle)
Local $iWindowWidth = $size[0]
Local $Window_height = $size[1]+33 ; including the title bar
; First hide the window
$aClassList = StringSplit(_WinGetClassListEx($window_handle), @LF)
$aM_Mask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', 0, 'long', 0)
; rectangle A - left side
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $pos_x, 'long', $Window_height)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; rectangle B - Top
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $iWindowWidth, 'long', $pos_y)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; rectangle C - Right side
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', $pos_x + $Image_Width , 'long', 0 , 'long', $iWindowWidth + 30, 'long', $Window_height)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; rectangle D - Bottom
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0 , 'long', $pos_y + $Image_Height, 'long', $iWindowWidth, 'long', $Window_height)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; now unhide all regions as defined in array $PictArray
For $i = 0 To (UBound($PictArray) - 1)
$Block_value = StringSplit($PictArray[$i],',')
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', $pos_x + $Block_value[1] - 1 , 'long', $pos_y + $Block_value[2], 'long', $pos_x + $Block_value[3], 'long', $pos_y + $Block_value[4] -1)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
Next
DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $window_handle, 'long', $aM_Mask[0], 'int', 1)
$PictArray='' ; empty array
EndFunc ;==>_GuiImageHole
#FUNCTION# ==============================================================
Func _WinGetClassListEx($sTitle)
    Local $sClassList = WinGetClassList($sTitle)
    Local $aClassList = StringSplit($sClassList, @LF)
    Local $sRetClassList = '', $sHold_List = '|'
    Local $aiInHold, $iInHold
    For $i = 1 To UBound($aClassList) - 1
        If $aClassList[$i] = '' Then ContinueLoop
        If StringRegExp($sHold_List, '\|' & $aClassList[$i] & '~(\d+)\|') Then
            $aiInHold = StringRegExp($sHold_List, '.*\|' & $aClassList[$i] & '~(\d+)\|.*', 1)
            $iInHold = Number($aiInHold[UBound($aiInHold)-1])
            If $iInHold = 0 Then $iInHold += 1
            $aClassList[$i] &= '~' & $iInHold + 1
            $sHold_List &= $aClassList[$i] & '|'
            $sRetClassList &= $aClassList[$i] & @LF
        Else
            $aClassList[$i] &= '~1'
            $sHold_List &= $aClassList[$i] & '|'
            $sRetClassList &= $aClassList[$i] & @LF
        EndIf
    Next
    Return StringReplace(StringStripWS($sRetClassList, 3), '~', '')
EndFunc ;==>_WinGetClassListEx
#FUNCTION# ==============================================================
#EndRegion Perforated Image
#EndRegion Functions
Edited by GreenCan

Contributions

CheckUpdate - SelfUpdating script ------- Self updating script

Dynamic input validation ------------------- Use a Input masks can make your life easier and Validation can be as simple

MsgBox with CountDown ------------------- MsgBox with visual countdown

Display Multiline text cells in ListView ---- Example of pop-up or ToolTip for multiline text items in ListView

Presentation Manager ---------------------- Program to display and refresh different Border-less GUI's on a Display (large screen TV)

USB Drive Tools ------------------------------ Tool to help you with your USB drive management

Input Period udf ------------------------------ GUI for a period input

Excel ColorPicker ---------------------------- Color pickup tool will allow you to select a color from the standard Excel color palette

Excel Chart UDF ----------------------------- Collaboration project with water 

GetDateInString ------------------------------ Find date/time in a string using a date format notation like DD Mon YYYY hh:mm

TaskListAllDetailed --------------------------- List All Scheduled Tasks

Computer Info --------------------------------- A collection of information for helpdesk

Shared memory Demo ----------------------- Demo: Two applications communicate with each other through means of a memory share (using Nomad function, 32bit only)

Universal Date Format Conversion -------- Universal date converter from your PC local date format to any format

Disable Windows DetailsPane -------------- Disable Windows Explorer Details Pane

Oracle SQL Report Generator -------------  Oracle Report generator using SQL

SQLite Report Generator -------------------  SQLite Report generator using SQL

SQLite ListView and BLOB demo ---------- Demo: shows how binary (image) objects can be recognized natively in a database BLOB field

DSN-Less Database connection demo --- Demo: ActiveX Data Objects DSN-Less Database access

Animated animals ----------------------------- Fun: Moving animated objects

Perforated image in GUI --------------------- Fun: Perforate your image with image objects

UEZ's Perforator major update ------------- Fun: Pro version of Perforator by UEZ

Visual Crop Tool (GUI) ----------------------- Easy to use Visual Image Crop tool

Visual Image effect (GUI) -------------------- Visually apply effects on an image

 

 

 

Share this post


Link to post
Share on other sites

Well I did have other plans for it, but got a little sidetracked.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Many, but I moved on.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Here is the GUI I use as base for my 'About' window, enhanced by a perforated logo that I made a long time ago...

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Description=Gui with perforated image
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=A. greenCan
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <Date.au3>
#include <String.au3>
About("Database SQL")
Exit
#Region Functions
#FUNCTION# ==============================================================
Func About($sTitle)
Local $iWindowWidth = 250, $iWindowHeight = 110, $Msg
$sTitle = _StringRepeat(" ", Int( (($iWindowWidth / 5.9) - StringLen($sTitle))/2)) & $sTitle ; center title
Local $sVersion = FileGetVersion(@ScriptName), $aVersionDate = FileGetTime ( @ScriptName , 1 ,0 )
Local $About = GuiCreate($sTitle, $iWindowWidth, $iWindowHeight, -1,-1,$WS_CAPTION, $WS_EX_TOPMOST)
GuiSetBkColor(0x0000FF)
GuiCtrlCreateLabel("Author: A. GreenCan" & @CR & "Ver " & $sVersion & @CR & _DateToMonth($aVersionDate[1], 1 ) & " " & $aVersionDate[0], ($iWindowWidth-120)/2, 10,120,50)
GUICtrlSetColor (-1, 0xFFFFFF)
GuiCtrlCreateLabel("", 10,55, $iWindowWidth - 20,1) ; white line
GuiCtrlSetBkColor(-1, 0xFFFFFF)
Local $sOK = GUICtrlCreateButton("OK", 10, $iWindowHeight - 40, 70,22, $BS_DEFPUSHBUTTON )
; Perforated Image
Local $iLeftPos = $iWindowWidth - 145
Local $iTopPos = $iWindowHeight - 20
_GuiImageHole($About, $iLeftPos, $iTopPos, 136, 41)
$iBegin = TimerInit()
GUISetState()
While 1
$Msg = GUIGetMsg()
Select
Case $Msg = $GUI_EVENT_CLOSE
ExitLoop
Case $Msg = $sOK
ExitLoop
Case TimerDiff($iBegin) > 10000 ; close after 10 sec
ExitLoop
EndSelect
WEnd
GUIDelete($About)
Return
EndFunc ;==>About
#FUNCTION# ==============================================================
#Region Perforated Image
#FUNCTION# ==============================================================
Func _GuiImageHole($window_handle, $pos_x, $pos_y,$Image_Width ,$Image_Height)
    Local $aClassList, $aM_Mask, $aMask, $Block_value
#Region picture array
    Local $PictArray[262] = [ _
'3,1,48,1','50,1,137,1','3,2,48,2','50,2,93,2','94,2,137,2','1,3,2,3','4,3,47,3','49,3,92,3','95,3,137,3','1,4,3,4','5,4,25,4','28,4,46,4','48,4,92,4','95,4,137,4','1,5,3,5','5,5,25,5','29,5,45,5','48,5,92,5','95,5,137,5','1,6,4,6', _
'6,6,24,6','30,6,45,6','47,6,92,6','96,6,137,6','1,7,5,7','7,7,9,7','10,7,23,7','30,7,38,7','42,7,44,7','46,7,93,7','96,7,137,7','1,8,6,8','11,8,24,8','29,8,37,8','45,8,66,8','68,8,93,8','96,8,137,8','1,9,6,9','13,9,24,9','30,9,36,9', _
'44,9,66,9','69,9,87,9','91,9,93,9','97,9,137,9','1,10,6,10','13,10,23,10','31,10,37,10','43,10,65,10','71,10,86,10','92,10,93,10','97,10,137,10','1,11,6,11','12,11,22,11','32,11,35,11','42,11,65,11','71,11,86,11','92,11,93,11','97,11,137,11','1,12,6,12','15,12,22,12', _
'32,12,34,12','43,12,50,12','54,12,65,12','70,12,86,12','97,12,137,12','1,13,5,13','18,13,21,13','32,13,33,13','44,13,49,13','55,13,65,13','72,13,86,13','96,13,137,13','1,14,5,14','15,14,16,14','44,14,48,14','55,14,64,14','73,14,86,14','96,14,137,14','1,15,4,15','15,15,20,15', _
'45,15,48,15','54,15,64,15','74,15,85,15','96,15,137,15','1,16,4,16','17,16,19,16','46,16,48,16','55,16,63,16','75,16,84,16','96,16,137,16','1,17,5,17','17,17,18,17','46,17,47,17','56,17,63,17','76,17,84,17','97,17,137,17','1,18,5,18','17,18,18,18','46,18,47,18','56,18,63,18', _
'77,18,84,18','97,18,137,18','1,19,6,19','16,19,18,19','33,19,34,19','57,19,63,19','77,19,84,19','98,19,137,19','1,20,6,20','16,20,17,20','32,20,34,20','58,20,63,20','77,20,84,20','98,20,137,20','1,21,6,21','16,21,17,21','32,21,34,21','58,21,63,21','78,21,83,21','98,21,137,21', _
'1,22,6,22','32,22,34,22','58,22,63,22','78,22,83,22','98,22,137,22','1,23,6,23','57,23,64,23','78,23,82,23','98,23,137,23','1,24,6,24','57,24,65,24','78,24,82,24','98,24,137,24','1,25,6,25','58,25,65,25','77,25,82,25','99,25,137,25','1,26,6,26','58,26,64,26','76,26,83,26', _
'99,26,137,26','1,27,7,27','32,27,33,27','46,27,47,27','58,27,64,27','77,27,83,27','100,27,137,27','1,28,7,28','31,28,33,28','46,28,47,28','58,28,65,28','77,28,83,28','99,28,137,28','2,29,7,29','31,29,33,29','59,29,65,29','78,29,84,29','98,29,137,29','7,30,8,30','16,30,18,30', _
'31,30,33,30','46,30,47,30','59,30,65,30','79,30,84,30','96,30,137,30','8,31,10,31','15,31,18,31','25,31,26,31','31,31,34,31','45,31,47,31','60,31,62,31','79,31,85,31','95,31,137,31','3,32,6,32','8,32,10,32','15,32,21,32','25,32,26,32','33,32,34,32','42,32,48,32','60,32,62,32', _
'78,32,85,32','95,32,137,32','34,33,35,33','39,33,40,33','42,33,49,33','60,33,62,33','76,33,86,33','95,33,120,33','125,33,130,33','135,33,137,33','38,34,39,34','44,34,51,34','76,34,88,34','95,34,122,34','125,34,129,34','131,34,134,34','135,34,137,34','47,35,51,35','55,35,60,35','64,35,65,35', _
'76,35,88,35','95,35,121,35','123,35,124,35','126,35,128,35','130,35,134,35','135,35,137,35','49,36,51,36','56,36,62,36','65,36,66,36','69,36,70,36','76,36,81,36','83,36,88,36','95,36,120,36','122,36,124,36','126,36,127,36','129,36,137,36','56,37,58,37','66,37,70,37','76,37,78,37','84,37,88,37', _
'95,37,120,37','122,37,124,37','126,37,127,37','129,37,131,37','135,37,137,37','67,38,71,38','77,38,79,38','84,38,89,38','95,38,119,38','126,38,127,38','129,38,132,38','134,38,137,38','32,39,33,39','85,39,89,39','95,39,118,39','120,39,124,39','126,39,127,39','129,39,132,39','134,39,137,39','18,40,24,40', _
'26,40,41,40','86,40,89,40','95,40,117,40','121,40,123,40','127,40,128,40','134,40,137,40','14,41,46,41','85,41,89,41','95,41,137,41','9,42,52,42','88,42,89,42','97,42,137,42','7,43,55,43','57,43,59,43','62,43,65,43','67,43,69,43','70,43,73,43','100,43,137,43','6,44,79,44','100,44,137,44', _
'4,45,81,45','100,45,137,45']
#EndRegion picture array
; get the size of the active window
Local $size = WinGetClientSize($window_handle)
Local $iWindowWidth = $size[0]
Local $Window_height = $size[1]+33 ; including the title bar
; First hide the window
$aClassList = StringSplit(_WinGetClassListEx($window_handle), @LF)
$aM_Mask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', 0, 'long', 0)
; rectangle A - left side
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $pos_x, 'long', $Window_height)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; rectangle B - Top
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0, 'long', 0, 'long', $iWindowWidth, 'long', $pos_y)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; rectangle C - Right side
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', $pos_x + $Image_Width , 'long', 0 , 'long', $iWindowWidth + 30, 'long', $Window_height)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; rectangle D - Bottom
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', 0 , 'long', $pos_y + $Image_Height, 'long', $iWindowWidth, 'long', $Window_height)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
; now unhide all regions as defined in array $PictArray
For $i = 0 To (UBound($PictArray) - 1)
$Block_value = StringSplit($PictArray[$i],',')
$aMask = DllCall('gdi32.dll', 'long', 'CreateRectRgn', 'long', $pos_x + $Block_value[1] - 1 , 'long', $pos_y + $Block_value[2], 'long', $pos_x + $Block_value[3], 'long', $pos_y + $Block_value[4] -1)
DllCall('gdi32.dll', 'long', 'CombineRgn', 'long', $aM_Mask[0], 'long', $aMask[0], 'long', $aM_Mask[0], 'int', 2)
Next
DllCall('user32.dll', 'long', 'SetWindowRgn', 'hwnd', $window_handle, 'long', $aM_Mask[0], 'int', 1)
$PictArray='' ; empty array
EndFunc ;==>_GuiImageHole
#FUNCTION# ==============================================================
Func _WinGetClassListEx($sTitle)
    Local $sClassList = WinGetClassList($sTitle)
    Local $aClassList = StringSplit($sClassList, @LF)
    Local $sRetClassList = '', $sHold_List = '|'
    Local $aiInHold, $iInHold
    For $i = 1 To UBound($aClassList) - 1
        If $aClassList[$i] = '' Then ContinueLoop
        If StringRegExp($sHold_List, '\|' & $aClassList[$i] & '~(\d+)\|') Then
            $aiInHold = StringRegExp($sHold_List, '.*\|' & $aClassList[$i] & '~(\d+)\|.*', 1)
            $iInHold = Number($aiInHold[UBound($aiInHold)-1])
            If $iInHold = 0 Then $iInHold += 1
            $aClassList[$i] &= '~' & $iInHold + 1
            $sHold_List &= $aClassList[$i] & '|'
            $sRetClassList &= $aClassList[$i] & @LF
        Else
            $aClassList[$i] &= '~1'
            $sHold_List &= $aClassList[$i] & '|'
            $sRetClassList &= $aClassList[$i] & @LF
        EndIf
    Next
    Return StringReplace(StringStripWS($sRetClassList, 3), '~', '')
EndFunc ;==>_WinGetClassListEx
#FUNCTION# ==============================================================
#EndRegion Perforated Image
#EndRegion Functions

I love this!! But how on earth did you create that pic??!!

Share this post


Link to post
Share on other sites

Tab with Background color

#include <GuiConstantsEx.au3>
#include <GuiTab.au3>
#include <StaticConstants.au3>

; Tab colours
Global $aTabColours[4] = [0xFFC0C0, 0xC0FFC0, 0xC0C0FF, 0xC0C0C0]

; Create GUI
Global $hGUI = GUICreate ("Test", 400,300)
GUISetBkColor (0)

; Create label to cover tab "tab"
Global $ahColourTab[4]
For $i = 0 to 3
    $ahColourTab[$i] = GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_NOTIFY, $SS_CENTER, $SS_SUNKEN))
Next
;~ Global $hColourTab = GUICtrlCreateLabel("", 0, 0, 1, 1, BitOR($SS_NOTIFY, $SS_CENTER, $SS_SUNKEN))

; Create tab
Global $hTab = GUICtrlCreateTab(5, 5,390, 290)
Global $hTab_Handle = GUICtrlGetHandle($hTab)

; Create tab items and colour them
For $i = 0 To 3
    GUICtrlCreateTabItem ("Tab item - " & $i)
    _GUICtrlTab_SetBkColor($hGUI, $hTab, $aTabColours[$i])
    GUICtrlCreateLabel('This is TAB #' & $i & ' content.',100,50)
    GUICtrlCreateTabItem ("")
Next
GUISetState()

; Pre sets of colours
For $i = 3 To 0 Step -1
    _GUICtrlTab_ClickTab($hTab_Handle, $i)
    TabEvent()
Next
_GUICtrlTab_SetCurSel($hTab_Handle,0)
_GUICtrlTab_SetCurFocus($hTab_Handle,0)
TabEvent()

While 1
    Switch GUIGetMsg ()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ahColourTab[0]
            _GUICtrlTab_ClickTab($hTab_Handle, 0)
        Case $ahColourTab[1]
            _GUICtrlTab_ClickTab($hTab_Handle, 1)
        Case $ahColourTab[2]
            _GUICtrlTab_ClickTab($hTab_Handle, 2)
        Case $ahColourTab[3]
            _GUICtrlTab_ClickTab($hTab_Handle, 3)
    EndSwitch
WEnd

Func TabEvent()

    ; Set values
    Local $iTab_X = 5, $iTab_Y = 5, $iTab_Margin = 1
    ; Get index of current tab
    Local $iTab_Index = GUICtrlRead($hTab)
    ; Get coordinates of TabItem
    Local $aTab_Coord = _GUICtrlTab_GetItemRect($hTab_Handle, $iTab_Index)
    ; Get text of TabItem
    Local $sTab_Text = _GUICtrlTab_GetItemText($hTab_Handle, $iTab_Index)
    ; Place label
    GUICtrlSetPos($ahColourTab[$iTab_Index], $iTab_X + $aTab_Coord[0] + $iTab_Margin, $iTab_Y + $aTab_Coord[1] + $iTab_Margin, $aTab_Coord[2] - $aTab_Coord[0] - ($iTab_Margin * 2), $aTab_Coord[3] - $aTab_Coord[1] - ($iTab_Margin * 2) + 5)
    ; Set text
    GUICtrlSetData($ahColourTab[$iTab_Index], $sTab_Text)
    ; Set colour
    GUICtrlsetBkColor($ahColourTab[$iTab_Index],$aTabColours[$iTab_Index] )
    ; Set focus
    _GUICtrlTab_SetCurFocus($hTab_Handle,$iTab_Index)

EndFunc

Func _GUICtrlTab_SetBkColor($hWnd, $hSysTab32, $sBkColor)

    ; Get tab position
    Local $aTabPos = ControlGetPos($hWnd, "", $hSysTab32)
    ; Get size of user area
    Local $aTab_Rect = _GUICtrlTab_GetItemRect($hSysTab32, -1)
    ; Create label
    GUICtrlCreateLabel("", $aTabPos[0] + 2, $aTabPos[1] + $aTab_Rect[3] + 4, $aTabPos[2] - 6, $aTabPos[3] - $aTab_Rect[3] - 7)
    ; Colour label
    GUICtrlSetBkColor(-1, $sBkColor)
    ; Disable label
    GUICtrlSetState(-1, $GUI_DISABLE)

EndFunc   ;==>_GUICtrlTab_SetBkColor

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2020-09-20

Share this post


Link to post
Share on other sites

I get an error after I run that code with $gui not being declared.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites

Menu Bar Buttons

Yesterday I stumbled upon an idea. I needed to add some buttons to my GUI, but didn't have enough room. There was plenty  of room left on the menu bar, so that's where I decided put them. The method works fine on my machine (surprisingly perhaps). Please report if you experience any issues running the script, or if you know of a better way to do this. Thanks.

;

#include <GuiconstantsEx.au3>
#include <StaticConstants.au3>

_MenuButtons()

Func _MenuButtons()
    Local $hGUI = GUICreate("Menu Button Example", 270, 100)

    GUICtrlCreateMenu("        ") ; A menu has to be created first (this seems logical).
    GUICtrlSetState(-1, $GUI_DISABLE) ; The above menu is treated as a spacer.

    Local $hToStart = GUICtrlCreateMenuItem("  <<   ", -1) ; Menu items are now placed on the menu bar.
    Local $hStepBack = GUICtrlCreateMenuItem("   <   ", -1)
    Local $hPlay = GUICtrlCreateMenuItem("   P   ", -1)
    Local $hStepForward = GUICtrlCreateMenuItem("   >   ", -1)
    Local $hToEnd = GUICtrlCreateMenuItem("   >>  ", -1)

    Local $hLabel = GUICtrlCreateLabel("", 10, 25, 250, 20, $SS_CENTER)

    GUISetState(@SW_SHOW)

    Local $msg
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $hToStart
                GUICtrlSetData($hLabel, "Back to Start")
            Case $hStepBack
                GUICtrlSetData($hLabel, "Step Back")
            Case $hPlay
                GUICtrlSetData($hLabel, "Play / Pause")
            Case $hStepForward
                GUICtrlSetData($hLabel, "Step Forward")
            Case $hToEnd
                GUICtrlSetData($hLabel, "Forward to End")
        EndSwitch
    WEnd
EndFunc

;

The help file states that when setting menuID to -1 with GUICtrlCreateMenuItem(), '-1 refers to the first level menu'. For me, it's difficult to interpret what this means. The controls just appear on the menu bar, which I never (quite) thought of as being a menu: since it has no specific handle (that I know of) and is not clickable by default.

Also consider that if you remove the menu created in the example above, the code will no longer work as expected. I am at a loss to explain this. Testers needed!

Edited by czardas

Share this post


Link to post
Share on other sites

czardas, nice idea.

I made a couple of small adjustments and ended up with a miniature popup control panel.  For some uses, this will be far easier than defining buttons.  I had never looked at how the menu bar functioned (or didn't) in a popup.

Thanks.

post-29172-0-70784700-1404773207_thumb.p

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...