Jump to content

GUICtrlCreateEdit versus _GUICtrlEdit_Create


ahha
 Share

Recommended Posts

Gui newbie has a question.  Why is the _GUICtrlEdit_Create in the program (select No) not resizing the edit window.  I can't figure out what parameter I've not set correctly.

As an aside other than the $hWnd what's the advantage/difference of using _GUICtrl functions over GUICtrl?  Thanks.

#AutoIt3Wrapper_run_debug_mode=Y    ;use this to debug in console window <--- LOOK
#include <GuiConstants.au3>
#include <GuiEdit.au3>


$ans = MsgBox(4, "", "Run resizeable?")

If $ans = 6 Then

    $hGUI = GUICreate(@ScriptName, 500, 400, 700, 300, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX), $WS_EX_CLIENTEDGE)
    $hEdit = GUICtrlCreateEdit("This is resizeable.", 0, 0, 500, 400, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
    GUISetState(@SW_SHOW, $hGUI)

    While 1
        $Msg = GUIGetMsg()
        Select
            Case $Msg = $GUI_EVENT_CLOSE
                Exit
        EndSelect
    WEnd

Else

    $hGUI = GUICreate(@ScriptName, 500, 400, 700, 300, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX), $WS_EX_CLIENTEDGE)
    $hEdit = _GUICtrlEdit_Create($hGUI, "This is NOT resizeable. Outer GUI is.", 0, 0, 500, 400, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
    GUISetState(@SW_SHOW, $hGUI)

    While 1
        $Msg = GUIGetMsg()
        Select
            Case $Msg = $GUI_EVENT_CLOSE
                Exit
        EndSelect
    WEnd

EndIf

 

Link to comment
Share on other sites

Here a simple way to perform it :

#include <GuiConstants.au3>
#include <GuiEdit.au3>

Global $hGUI = GUICreate("Resize", 500, 400, 700, 300, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX), $WS_EX_CLIENTEDGE)
Global $hEdit = _GUICtrlEdit_Create($hGUI, "This is NOT resizeable. Outer GUI is.", 0, 0, 498, 380, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL))
GUISetState()
GUIRegisterMsg($WM_SIZING, WM_SIZING)

While 1
  Switch GUIGetMsg()
    Case $GUI_EVENT_CLOSE
      Exit
  EndSwitch
WEnd

Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
  Local $tRect = _WinAPI_GetClientRect($hWnd)
  _WinAPI_MoveWindow($hEdit, 0, 0, $tRect.right, $tRect.bottom, True)
  Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZING

 

Link to comment
Share on other sites

  • Moderators

ahha,

Quote

what's the advantage/difference of using _GUICtrl functions over GUICtrl?

Take a look at this thread.

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

@Nine Thanks that certainly works.  I still would like to know if a parameter can fix the _GUICtrlEdit_Create to work like the GUICtrlCreateEdit code and why the outer border is resizable and the inner is not.

@Melba23 Thanks that explains a lot, and the scary part is I think I understand it.  It looks like handles are preferable in most cases.

 

Link to comment
Share on other sites

  • Moderators

ahha,

Not so. Using native AutoIt controls means you can use native functions to modify them without difficulty. As with most things, there are pros and cons.

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

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

×
×
  • Create New...