Jump to content

Window in slide format


 Share

Go to solution Solved by taietel,

Recommended Posts

Hello friends!

Has anyone ever done something like this window in slide format?

BF2Mx3d.png

S6wJenX.png

I'm lousy at math calculations and I do not have much experience in such windows, who can give me a hand I am grateful!

 

JS

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

  • Moderators

JScript,

You could use my GUIExtender UDF to do something like this:

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

#include <GUIExtender.au3>

$hGUI = GUICreate("Test", 500, 500)

GUISetState()

$hMenu = GUICreate("Menu", 480, 40, 10, 0, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)

_GUIExtender_Init($hMenu)

$iSection = _GUIExtender_Section_Start($hMenu, 0, 30)
$cButton_1 = GUICtrlCreateButton("Button 1", 0, 0, 80, 30)
$cButton_2 = GUICtrlCreateButton("Button 2", 80, 0, 80, 30)
$cButton_3 = GUICtrlCreateButton("Button 3", 160, 0, 80, 30)
$cButton_4 = GUICtrlCreateButton("Button 4", 240, 0, 80, 30)
$cButton_5 = GUICtrlCreateButton("Button 5", 320, 0, 80, 30)
$cButton_6 = GUICtrlCreateButton("Button 6", 400, 0, 80, 30)
_GUIExtender_Section_End($hMenu)

_GUIExtender_Section_Start($hMenu, 30, 10)
_GUIExtender_Section_Action($hMenu, $iSection, "", "", 0, 30, 480, 10, 1)
_GUIExtender_Section_End($hMenu)

_GUIExtender_Section_Extend($hMenu, $iSection, False)

GUISetState()

While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton_1 To $cButton_6
            MsgBox($MB_SYSTEMMODAL, "Clicked", "You clicked Button " & $iMsg - $cButton_1 + 1)
    EndSwitch
    _GUIExtender_Action($hMenu, $iMsg)
WEnd
Any use? :)

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

That looks more like graphical elements than an actual window. After you have learned how to draw boxes/lines/text in GDI+ (or however you decide to do it) then the math will be easy.

Link to comment
Share on other sites

@Melba23

It is an excellent option friend! I'll implement here, but I believe it is something with GDI, anyway I'll test your code, thanks!

@AdmiralAlkex

Yes, I think it is too, but not very well dominate this area, if you have examples in which I can adapt, or something.

Thanks for the attention of you friends,

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

  • Moderators

Just out of curiosity, is this just an example or are you actually trying to manipulate TeamViewer?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13

Hello, is just one example of demonstration, with that I will improve the look of my project '?do=embed' frameborder='0' data-embedContent>>

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Friends, I saw an example in the help file and made ​​some minor changes in the creation of the star, but did not quite understand the dynamics of the function.

 

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

; Create GUI
Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 500, 475, -1, -1, $WS_POPUP, $WS_EX_TOPMOST)
Local $idButton = GUICtrlCreateButton('Exit', 215, 10, 70, 23)
GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
GUISetBkColor(0xC0C0C0)

; Create polygonal region and set it to the window
Local $aPoint[10][2] = [[0, 0],[0, 0],[0, 100],[0, 0],[0, 0],[500, 0],[500, 60],[0, 60],[0, 0],[0, 0]]
Local $hRgn = _WinAPI_CreatePolygonRgn($aPoint)
_WinAPI_SetWindowRgn($hForm, $hRgn, 0)

GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $idButton

Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam

    Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST
If anyone knows how to model the example above...

JS

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

#cs
 <----------------------- $iW ----------------------->
 |
 |
$iH
 |
 |
 -                    <--------- $w -------><--- $r --->
                                |
                                |
                                $p
                                |
                                |
                                -
#ce
$iW=500
$iH=200
$w=90
$p=25
$r=20
$iFont=16
$bExpand=True

; Create GUI
Local $hForm = GUICreate("Test", $iW, $iH+$p, (@DesktopWidth-$iW+$w+$r)/2, -$iH, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0xdedede)

$hExit = GUICtrlCreateLabel("r", $iW-$r-$w/4-($iFont+4)/2, $iH+($p-($iFont+4))/2, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings")
GUICtrlSetColor(-1, 0x505050)
GUICtrlSetCursor(-1,0)

$hCfg = GUICtrlCreateLabel("@", $iW-$r-2*$w/4-($iFont+4)/2, $iH+($p-($iFont+4))/2, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings")
GUICtrlSetCursor(-1,0)
GUICtrlSetColor(-1, 0x505050)

$hExpand = GUICtrlCreateLabel("6", $iW-$r-3.5*$w/4-($iFont+4)/2, $iH+($p-($iFont+4))/2, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings")
GUICtrlSetCursor(-1,0)
GUICtrlSetColor(-1, 0x505050)

Local $aPoint[9][2] = [[0, 0],[$iW, 0],[$iW, $iH],[$iW-$r,$iH],[$iW-$r-$p/3,$iH+$p],[$iW-$r-$w,$iH+$p],[$iW-$r-$w-$p/3,$iH],[0, $iH],[0, 0]]
Local $hRgn = _WinAPI_CreatePolygonRgn($aPoint)
_WinAPI_SetWindowRgn($hForm, $hRgn, 0)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $hExit
            Exit
        Case $hCfg
            MsgBox(0,"","You won! What?...")
        Case $hExpand
            If $bExpand Then
                GUICtrlSetData($hExpand,"5")
                WinMove($hForm, "", (@DesktopWidth-$iW+$w+$r)/2, 0, $iW, $iH+$p,5)
                $bExpand=False
            Else
                GUICtrlSetData($hExpand,"6")
                WinMove($hForm, "", (@DesktopWidth-$iW+$w+$r)/2, -$iH, $iW, $iH+$p,5)
                $bExpand=True
            EndIf
    EndSwitch
WEnd

Try this, see if it fits. (modified: made some changes)

Edited by taietel
Link to comment
Share on other sites

@taietel

Excellent friend, is this basically what I wanted!!! This "graphic" explanation helped me understand the workings of  _WinAPI_CreatePolygonRgn() function:

#cs
 <----------------------- $iW ----------------------->
 |
 |
$iH
 |
 |
 -                    <--------- $w -------><--- $r --->
                                |
                                |
                                $p
                                |
                                |
                                -
#ce

I'll do some tests, Thanks mate!

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Here's a test I did in my program:
 

17DAv5c.png

One question: How to round the edges? There is a possibility for a shadow?

JS

Edited by JScript

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

Try now:

#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
;coded by taietel
#cs
 <----------------------- $iW ----------------------->
 |
 |
$iH
 |
 |
 -                    <--------- $w -------><--- $r --->
                                |
                                |
                                $p
                                |
                                |
                                -
#ce
$iW=500
$iFont=12
$iH=$iFont+4+20
$bExpand=True
$iNoIcnsExpand=3
$w=$iNoIcnsExpand*($iFont+4+10)
$p=25
$r=20

$iDelay=2
$iIcnExit="r"
$iIcnCfg="@"
$iIcnInfo="i"
$iIcnUp="5"
$iIcnDown="6"
$iIcnSep="|"
$iIcnChk="a"
$iIcnFull="1"
; Create GUI
Local $hForm = GUICreate("Test", $iW, $iH+$p, (@DesktopWidth-$iW+$w+$r)/2, -$iH, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0xdedede)

;------- Put some stuff on GUI ----------
$hExit = GUICtrlCreateLabel($iIcnExit, 5, $iH-($iFont+4)-10, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x505050)
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1,"Exit")

GUICtrlCreateLabel($iIcnSep, 5+$iFont+4, $iH-($iFont+4)-10, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x909090)

$hSomeStuff = GUICtrlCreateLabel($iIcnCfg,  5+2*($iFont+4), $iH-($iFont+4)-10, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x505050)

$hSomeStuff_l=GUICtrlCreateLabel("Some stuff", 5+3*($iFont+4), $iH-($iFont+4)-10, 80, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Arial",5)
GUICtrlSetColor(-1, 0x505050)

$hSomeStuffA = GUICtrlCreateLabel($iIcnDown, 5+3*($iFont+4)+80, $iH-($iFont+4)-10, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont-2, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x505050)
GUICtrlSetCursor(-1,0)

$DummyMenu = GUICtrlCreateDummy()
$hContextMenu = GUICtrlCreateContextMenu($DummyMenu)
$mnuSomeStuff = GUICtrlCreateMenuItem("Some Item", $hContextMenu)
$mnuExit = GUICtrlCreateMenuItem("Exit", $hContextMenu)

GUICtrlCreateLabel($iIcnSep, 5+4*($iFont+4)+80-5, $iH-($iFont+4)-10, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x909090)

GUICtrlCreateLabel($iIcnInfo,  5+5*($iFont+4)+80, $iH-($iFont+4)-10, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x505050)

$hAbout = GUICtrlCreateLabel("About", 5+6*($iFont+4)+80, $iH-($iFont+4)-10, 60, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Arial",5)
GUICtrlSetColor(-1, 0x505050)
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1,"About this program...")

GUICtrlCreateLabel($iIcnSep, 5+6*($iFont+4)+80+60, $iH-($iFont+4)-10, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x909090)

;------- end some stuff on GUI ----------
$hExpand = GUICtrlCreateLabel($iIcnDown, $iW-$r-$w/4-($iFont+4)/2, $iH+($p-($iFont+4))/2, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x505050)
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1,"Expand")

GUICtrlCreateLabel($iIcnSep, $iW-$r-2*$w/4-($iFont+4)/2, $iH+($p-($iFont+4))/2, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetColor(-1, 0x909090)

$hFullScreen = GUICtrlCreateLabel($iIcnFull, $iW-$r-3*$w/4-($iFont+4)/2, $iH+($p-($iFont+4))/2, $iFont+4, $iFont+4, BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings",5)
GUICtrlSetCursor(-1,0)
GUICtrlSetTip(-1,"Full Screen")
GUICtrlSetColor(-1, 0x505050)

Local $hRgn = _WinAPI_CreateRectRgn (0, 0, $iW-1, $iH/2)
Local $hRgn1 = _WinAPI_CreateRoundRectRgn(0, 0, $iW, $iH, 7, 7)
Local $hRgn2 = _WinAPI_CreateRoundRectRgn($iW-$r-$w, 2, $iW-$r, $iH+$p, 7, 7)
_WinAPI_CombineRgn($hRgn, $hRgn, $hRgn1, $RGN_OR)
_WinAPI_CombineRgn($hRgn, $hRgn, $hRgn2, $RGN_OR)
_WinAPI_DeleteObject($hRgn1)
_WinAPI_DeleteObject($hRgn2)
_WinAPI_SetWindowRgn($hForm, $hRgn, 1)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $hExit, $mnuExit
            Exit
        Case $hFullScreen
            MsgBox(0,"","Here you'll have to put the code for full screen mode.")
        Case $hAbout
            MsgBox(0,"","Here you'll have to put the code for About message.")
        Case $hExpand
            If $bExpand Then
                GUICtrlSetData($hExpand,$iIcnUp)
                WinMove($hForm, "", (@DesktopWidth-$iW+$w+$r)/2, 0, $iW, $iH+$p,$iDelay)
                GUICtrlSetTip($hExpand,"Retract")
                $bExpand=False
            Else
                GUICtrlSetData($hExpand,$iIcnDown)
                WinMove($hForm, "", (@DesktopWidth-$iW+$w+$r)/2, -$iH, $iW, $iH+$p,$iDelay)
                GUICtrlSetTip($hExpand,"Expand")
                $bExpand=True
            EndIf
        Case $hSomeStuffA, $hSomeStuff_l
            ShowMenu($hForm, $hContextMenu, $hSomeStuff)
    EndSwitch
WEnd

Func ShowMenu($hWnd, $nContextID, $nContextControlID, $iMouse=0)
    Local $hMenu = GUICtrlGetHandle($nContextID)
    Local $iCtrlPos = ControlGetPos($hWnd, "", $nContextControlID)

    Local $X = $iCtrlPos[0]
    Local $Y = $iCtrlPos[1] + $iCtrlPos[3]

    ClientToScreen($hWnd, $X, $Y)

    If $iMouse Then
        $X = MouseGetPos(0)
        $Y = MouseGetPos(1)
    EndIf

    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $X, "int", $Y, "hwnd", $hWnd, "ptr", 0)
EndFunc

; Convert the client (GUI) coordinates to screen (desktop) coordinates
Func ClientToScreen($hWnd, ByRef $x, ByRef $y)
    Local $stPoint = DllStructCreate("int;int")

    DllStructSetData($stPoint, 1, $x)
    DllStructSetData($stPoint, 2, $y)

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

    $x = DllStructGetData($stPoint, 1)
    $y = DllStructGetData($stPoint, 2)
    ; release Struct not really needed as it is a local
    $stPoint = 0
EndFunc
Edited by taietel
Link to comment
Share on other sites

I following this thread and I would say:
This is fantastic.

mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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 TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

I notcie One issue  or this is only my question:

There is a Combo like button "Some Sutff"

Whether it is posibble to open combo list after clicking in "Some stuff" text, not only in the arrow symbol ?

EDIT:
oh.. I see About button works quite similar to my requests.

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor 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 * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

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 * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

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 TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

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 *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"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: 2023-04-24

Link to comment
Share on other sites

@taietel

Hello friend!

First, thanks for your help, the result was better than I thought, was excellent!

I noticed you did not use the function of polygons, so I assume that the effect shown below is no longer possible:

S8Hdep5.png

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

  • Solution

 

I noticed you did not use the function of polygons, so I assume that the effect shown below is no longer possible:

S8Hdep5.png

JScript, try now:

#include <GUIConstantsEx.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
;coded by taietel

_SlideWindow()
Func _SlideWindow()
    Local $iW = 600, $iFont = 12, $iH = $iFont + 4 + 20, $bExpand = True, $iNoIcnsExpand = 3, $w = $iNoIcnsExpand * ($iFont + 4 + 10), $p = 25, $r = 25, $iDelay = 2
    Local $iIcnExit = "r",  $iIcnCfg = "@", $iIcnInfo = "i",    $iIcnUp = "5",  $iIcnDown = "6",    $iIcnSep = "|", $iIcnChk = "a", $iIcnFull = "1"
    ; Create GUI
    Local $hForm = GUICreate("Test", $iW, $iH + $p, (@DesktopWidth - $iW + $w + $r) / 2, -$iH, $WS_POPUP, $WS_EX_TOPMOST)
    GUISetBkColor(0xdedede)

    ;------- Put some stuff on GUI ----------
    Local $hExit = GUICtrlCreateLabel($iIcnExit, 5, $iH - ($iFont + 4) - 10, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x505050)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetTip(-1, "Exit")

    GUICtrlCreateLabel($iIcnSep, 5 + $iFont + 4, $iH - ($iFont + 4) - 10, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x909090)

    Local $hSomeStuff = GUICtrlCreateLabel($iIcnCfg, 5 + 2 * ($iFont + 4), $iH - ($iFont + 4) - 10, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x505050)

    Local $hSomeStuff_l = GUICtrlCreateLabel("Some stuff", 5 + 3 * ($iFont + 4), $iH - ($iFont + 4) - 10, 80, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Arial", 5)
    GUICtrlSetColor(-1, 0x505050)
    GUICtrlSetTip(-1, "Click for menu")
    GUICtrlSetCursor(-1, 0)

    Local $hSomeStuffA = GUICtrlCreateLabel($iIcnDown, 5 + 3 * ($iFont + 4) + 80, $iH - ($iFont + 4) - 10, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont - 2, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x505050)
    GUICtrlSetTip(-1, "Click for menu")
    GUICtrlSetCursor(-1, 0)

    Local $DummyMenu = GUICtrlCreateDummy()
    Local $hContextMenu = GUICtrlCreateContextMenu($DummyMenu)
    Local $mnuSomeStuff = GUICtrlCreateMenuItem("Some Item", $hContextMenu)
    Local $mnuExit = GUICtrlCreateMenuItem("Exit", $hContextMenu)

    GUICtrlCreateLabel($iIcnSep, 5 + 4 * ($iFont + 4) + 80 - 5, $iH - ($iFont + 4) - 10, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x909090)

    GUICtrlCreateLabel($iIcnInfo, 5 + 5 * ($iFont + 4) + 80, $iH - ($iFont + 4) - 10, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x505050)

    Local $hAbout = GUICtrlCreateLabel("About", 5 + 6 * ($iFont + 4) + 80, $iH - ($iFont + 4) - 10, 60, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Arial", 5)
    GUICtrlSetColor(-1, 0x505050)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetTip(-1, "About this program...")

    GUICtrlCreateLabel($iIcnSep, 5 + 6 * ($iFont + 4) + 80 + 60, $iH - ($iFont + 4) - 10, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x909090)

    ;------- end some stuff on GUI ----------
    Local $hExpand = GUICtrlCreateLabel($iIcnDown, $iW - $r - $w / 4 - ($iFont + 4) / 2, $iH + ($p - ($iFont + 4)) / 2, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x505050)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetTip(-1, "Expand")

    GUICtrlCreateLabel($iIcnSep, $iW - $r - 2 * $w / 4 - ($iFont + 4) / 2, $iH + ($p - ($iFont + 4)) / 2, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetColor(-1, 0x909090)

    Local $hFullScreen = GUICtrlCreateLabel($iIcnFull, $iW - $r - 3 * $w / 4 - ($iFont + 4) / 2, $iH + ($p - ($iFont + 4)) / 2, $iFont + 4, $iFont + 4, BitOR($SS_CENTER, $SS_CENTERIMAGE))
    GUICtrlSetFont(-1, $iFont, 400, 0, "Webdings", 5)
    GUICtrlSetCursor(-1, 0)
    GUICtrlSetTip(-1, "Full Screen")
    GUICtrlSetColor(-1, 0x505050)

    Local $hRgn = _WinAPI_CreateRectRgn(0, 0, $iW - 1, $iH / 2)
    Local $hRgn1 = _WinAPI_CreateRoundRectRgn(0, 0, $iW, $iH, 7, 7)
    Local $hRgn2 = _WinAPI_CreateRoundRectRgn($iW - $r - $w, 2, $iW - $r, $iH + $p, 7, 7)
    Local $hRgn3 = _WinAPI_CreateRectRgn($iW - $r - $w - 5, 2, $iW - $r - $w, $iH + $p)
    Local $aPointl[3][2] = [[$iW - $r - $w - 5, $iH - 1], [$iW - $r - $w, $iH + $p], [$iW - $r - $w, $iH - 1]]
    Local $hRgn3 = _WinAPI_CreatePolygonRgn($aPointl)
    Local $aPointr[3][2] = [[$iW - $r + 5, $iH - 1], [$iW - $r - 2, $iH + $p - 1], [$iW - $r - 1, $iH - 1]]
    Local $hRgn4 = _WinAPI_CreatePolygonRgn($aPointr)
    _WinAPI_CombineRgn($hRgn, $hRgn, $hRgn1, $RGN_OR)
    _WinAPI_CombineRgn($hRgn, $hRgn, $hRgn2, $RGN_OR)
    _WinAPI_CombineRgn($hRgn, $hRgn, $hRgn3, $RGN_OR)
    _WinAPI_CombineRgn($hRgn, $hRgn, $hRgn4, $RGN_OR)
    _WinAPI_DeleteObject($hRgn1)
    _WinAPI_DeleteObject($hRgn2)
    _WinAPI_DeleteObject($hRgn3)
    _WinAPI_DeleteObject($hRgn4)

    _WinAPI_SetWindowRgn($hForm, $hRgn, 1)

    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $hExit, $mnuExit
                Exit
            Case $hFullScreen
                MsgBox(0, "", "Here you'll have to put the code for full screen mode.")
            Case $mnuSomeStuff
                MsgBox(0,"","stuff...")
            Case $hAbout
                MsgBox(0, "", "Here you'll have to put the code for About message.")
            Case $hExpand
                If $bExpand Then
                    GUICtrlSetData($hExpand, $iIcnUp)
                    WinMove($hForm, "", (@DesktopWidth - $iW + $w + $r) / 2, 0, $iW, $iH + $p, $iDelay)
                    GUICtrlSetTip($hExpand, "Retract")
                    $bExpand = False
                Else
                    GUICtrlSetData($hExpand, $iIcnDown)
                    WinMove($hForm, "", (@DesktopWidth - $iW + $w + $r) / 2, -$iH, $iW, $iH + $p, $iDelay)
                    GUICtrlSetTip($hExpand, "Expand")
                    $bExpand = True
                EndIf
            Case $hSomeStuffA, $hSomeStuff_l
                ShowMenu($hForm, $hContextMenu, $hSomeStuff)
        EndSwitch
    WEnd
EndFunc   ;==>_test

Func ShowMenu($hWnd, $nContextID, $nContextControlID, $iMouse = 0)
    Local $hMenu = GUICtrlGetHandle($nContextID)
    Local $iCtrlPos = ControlGetPos($hWnd, "", $nContextControlID)

    Local $X = $iCtrlPos[0]
    Local $Y = $iCtrlPos[1] + $iCtrlPos[3]

    ClientToScreen($hWnd, $X, $Y)

    If $iMouse Then
        $X = MouseGetPos(0)
        $Y = MouseGetPos(1)
    EndIf

    DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $X, "int", $Y, "hwnd", $hWnd, "ptr", 0)
EndFunc   ;==>ShowMenu

; Convert the client (GUI) coordinates to screen (desktop) coordinates
Func ClientToScreen($hWnd, ByRef $X, ByRef $Y)
    Local $stPoint = DllStructCreate("int;int")

    DllStructSetData($stPoint, 1, $X)
    DllStructSetData($stPoint, 2, $Y)

    DllCall("user32.dll", "int", "ClientToScreen", "hwnd", $hWnd, "ptr", DllStructGetPtr($stPoint))

    $X = DllStructGetData($stPoint, 1)
    $Y = DllStructGetData($stPoint, 2)
    ; release Struct not really needed as it is a local
    $stPoint = 0
EndFunc   ;==>ClientToScreen
Link to comment
Share on other sites

This snippet caught my attention:

Local $hRgn3 = _WinAPI_CreateRectRgn($iW - $r - $w - 5, 2, $iW - $r - $w, $iH + $p)

   Local $hRgn3 = _WinAPI_CreatePolygonRgn($aPointl)

The variable has been redefined...

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

@taietel: nice to see you active again!  :thumbsup:  Btw, nice code.

 

One thing bothered me. When you click on the arrow that the GUI moves down the controls are flickering.

 

Using GUISetState(@SW_LOCK, $hForm) disables flickering:

Case $hExpand
                If $bExpand Then
                    GUICtrlSetData($hExpand, $iIcnUp)
                    GUISetState(@SW_LOCK, $hForm)
                    WinMove($hForm, "", (@DesktopWidth - $iW + $w + $r) / 2, 0, $iW, $iH + $p, $iDelay)
                    GUISetState(@SW_UNLOCK, $hForm)
                    GUICtrlSetTip($hExpand, "Retract")
                    $bExpand = False
                Else
                    GUICtrlSetData($hExpand, $iIcnDown)
                    WinMove($hForm, "", (@DesktopWidth - $iW + $w + $r) / 2, -$iH, $iW, $iH + $p, $iDelay)
                    GUICtrlSetTip($hExpand, "Expand")
                    $bExpand = True
                EndIf

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

@UEZ

In this way is much better:

Case $hExpand
                If $bExpand Then
                    GUICtrlSetData($hExpand, $iIcnUp)
                    For $i = -$iH To 0 Step $iDelay
                        _WinAPI_MoveWindow($hForm, (@DesktopWidth - $iW) / 2, $i, $iW, $iH + $p)
                        Sleep(10)
                    Next
                    GUICtrlSetTip($hExpand, "Retract")
                    $bExpand = False
                Else
                    GUICtrlSetData($hExpand, $iIcnDown)
                    For $i = 0 To -$iH Step -$iDelay
                        _WinAPI_MoveWindow($hForm, (@DesktopWidth - $iW) / 2, $i, $iW, $iH + $p)
                        Sleep(10)
                    Next
                    GUICtrlSetTip($hExpand, "Expand")
                    $bExpand = True
                EndIf

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

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