Sign in to follow this  
Followers 0
momar33

Edit box doesn't work when its in a child window

5 posts in this topic

#1 ·  Posted (edited)

Not sure if i am missing something or not, but it seems that edit controls do not work on child windows.

Any info on this or is there a way around it?

My goal is to have the edit on a tab within the child.

Here is an example:

#include <GUIConstants.au3>

$mainGui = GUICreate("My GUI Tab")  ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
GUISetState ()

$child = GUICreate("View Spells", 400, 350, 0, 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CHILD), Default, $mainGui)
GUICtrlCreateEdit("Why can't i edit this?", 15, 40, 370, 300, $WS_VSCROLL)

;~ $tab=GUICtrlCreateTab (10,10, 200,100)

;~ $tab0=GUICtrlCreateTabitem ("tab0")


;~ $tab1=GUICtrlCreateTabitem ( "tab----1")


;~ $tab2=GUICtrlCreateTabitem ("tab2")
;~ GUICtrlSetState(-1,$GUI_SHOW)   ; will be display first
;~ GUICtrlCreateEdit("Why can't i edit this?", 15, 40, 370, 300, $WS_VSCROLL)

;~ GUICtrlCreateTabitem ("")   ; end tabitem definition

;GUICtrlCreateLabel ("label3", 20,130,50,20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Edited by momar33

Share this post


Link to post
Share on other sites



Not sure if i am missing something or not, but it seems that edit controls do not work on child windows.

Any info on this or is there a way around it?

My goal is to have the edit on a tab within the child.

Here is an example:

#include <GUIConstants.au3>

$mainGui = GUICreate("My GUI Tab")  ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
GUISetState ()

$child = GUICreate("View Spells", 400, 350, 0, 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CHILD), Default, $mainGui)
GUICtrlCreateEdit("Why can't i edit this?", 15, 40, 370, 300, $WS_VSCROLL)

;~ $tab=GUICtrlCreateTab (10,10, 200,100)

;~ $tab0=GUICtrlCreateTabitem ("tab0")
;~ $tab1=GUICtrlCreateTabitem ( "tab----1")
;~ $tab2=GUICtrlCreateTabitem ("tab2")
;~ GUICtrlSetState(-1,$GUI_SHOW)   ; will be display first
;~ GUICtrlCreateEdit("Why can't i edit this?", 15, 40, 370, 300, $WS_VSCROLL)

;~ GUICtrlCreateTabitem ("")   ; end tabitem definition

;GUICtrlCreateLabel ("label3", 20,130,50,20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

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.

Share this post


Link to post
Share on other sites

Ok that does let you edit the text. But why can't i highlight text with the mouse?

I checked and you CAN do this in a normal edit.

Share this post


Link to post
Share on other sites

Ok that does let you edit the text. But why can't i highlight text with the mouse?

I checked and you CAN do this in a normal edit.

I'm afraid I don't understand it. The problem goes if the child window doesn't have a title bar, but that just introduces another problem.

The mouse is having no effect in the edit. You can't select the edit by clicking in it, but the GUICtrlSetState($ed,$GUI_FOCUS) got round that. If you move the caret with the cursor keys you can't change it by clicking somewhere else with the mouse. Equally, dragging over characters doesn't work but, strangely, double clicking does highlight a word.

I've tried modifying some other scripts to put edit in child windows and I get the same problem.

Looks like a bug to me but it would be best to get some other opinions.


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.

Share this post


Link to post
Share on other sites

Eureka!

I figured it out. If you take out the CHILD style and add a dll call it will work, it also fixes another problem i had were focus would not change between child guis unless i clicked on the title bar.

Here is the end code:

#include <GUIConstants.au3>

$mainGui = GUICreate("My GUI Tab")  ; will create a dialog box that when displayed is centered

GUISetBkColor(0x00E0FFFF)
GUISetFont(9, 300)
GUISetState ()

$child = GUICreate("View Spells", 400, 350, 0, 0, $WS_OVERLAPPEDWINDOW, Default, $mainGui)
DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($child), "hwnd", WinGetHandle($mainGui))
GUICtrlCreateEdit("Why can't i edit this?", 15, 40, 370, 300, $WS_VSCROLL)

;~ $tab=GUICtrlCreateTab (10,10, 200,100)

;~ $tab0=GUICtrlCreateTabitem ("tab0")


;~ $tab1=GUICtrlCreateTabitem ( "tab----1")


;~ $tab2=GUICtrlCreateTabitem ("tab2")
;~ GUICtrlSetState(-1,$GUI_SHOW)   ; will be display first
;~ GUICtrlCreateEdit("Why can't i edit this?", 15, 40, 370, 300, $WS_VSCROLL)

;~ GUICtrlCreateTabitem ("")   ; end tabitem definition

;GUICtrlCreateLabel ("label3", 20,130,50,20)

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
   
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

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  
Followers 0