Peter422

Replace text in Inputbox with CTRLSetData

4 posts in this topic

Func Combo13Change() ;No Monitors
IniWrite($IniDir,"Config","Combo13",GUICtrlRead($Combo13))
If GUICtrlRead($Combo13) = "1" Then
GUICtrlSetData($Input1,$X0,"0")
GUICtrlSetData($Input2,$X1,"1916")
GUICtrlSetData($Input3,$X2,"3836")
ElseIf GUICtrlRead($Combo13) = "2" Then
GUICtrlSetData($Input1,$XM1,"-1924")
GUICtrlSetData($Input2,$X0,"-4")
GUICtrlSetData($Input3,$X1,"1916")
ElseIf GUICtrlRead($Combo13) = "3" Then
GUICtrlSetData($Input1,$XM2,"-3836")
GUICtrlSetData($Input2,$XM1,"-1924")
GUICtrlSetData($Input3,$X0,"-4")
EndIf

EndFunc

Hi Forum!

I have a Tabbed GUIForm With inputboxes that I want to change With CTRLSetData

However, when I make the COMBOBOX change the $Input does not replace the data, it inserts text ot top of what's already written.

What can I do the the script so the text in the input boxes is replaces?

 

;~ SHEET 3
$TabSheet3 = GUICtrlCreateTabItem("Window Settings")
$Combo13 = GUICtrlCreateCombo(IniRead("U:\AppMan\Config\" & @UserName & ".ini","Config","Combo13","3"), 24, 64, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "1|2|3")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Combo13Change")
$Input1 = GUICtrlCreateInput(IniRead("U:\AppMan\Config\" & @UserName & ".ini","Config","Input1","-4"), 53, 118, 65, 22)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Input1Change")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input2 = GUICtrlCreateInput(IniRead("U:\AppMan\Config\" & @UserName & ".ini","Config","Input2","-4"), 128, 118, 65, 22)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Input2Change")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input3 = GUICtrlCreateInput(IniRead("U:\AppMan\Config\" & @UserName & ".ini","Config","Input3","-4"), 198, 118, 65, 22)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Input3Change")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input4 = GUICtrlCreateInput(IniRead("U:\AppMan\Config\" & @UserName & ".ini","Config","Input4","-4"), 53, 161, 65, 22)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Input4Change")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input5 = GUICtrlCreateInput(IniRead("U:\AppMan\Config\" & @UserName & ".ini","Config","Input5","-4"), 128, 161, 65, 22)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Input5Change")
GUICtrlSetState(-1, $GUI_DISABLE)
$Input6 = GUICtrlCreateInput(IniRead("U:\AppMan\Config\" & @UserName & ".ini","Config","Input6","-4"), 198, 161, 65, 22)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Input6Change")
GUICtrlSetState(-1, $GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("Screen1", 56, 96, 45, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label3 = GUICtrlCreateLabel("Screen 2", 128, 96, 48, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label4 = GUICtrlCreateLabel("Screen 3", 200, 96, 48, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label5 = GUICtrlCreateLabel("X Pos", 16, 120, 32, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label6 = GUICtrlCreateLabel("Y Pos", 16, 160, 33, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label1 = GUICtrlCreateLabel("Select Main Monitor", 24, 40, 98, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Label1Click")
$Button3 = GUICtrlCreateButton("Tile All", 16, 224, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "Button3Click")
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("Save", 246, 272, 75, 25)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("&Cancel", 326, 272, 75, 25)
GUICtrlSetOnEvent(-1, "Button2Click")


GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

 

Share this post


Link to post
Share on other sites



you may need to set the input to "" then set it again to your data

example:  

GUICtrlSetData($Input2,$X1, "")
GUICtrlSetData($Input2,$X1,"1916")

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Post a runable (reproducer) script showing the issue(s).

Edited by AutoBert

Share this post


Link to post
Share on other sites

Thanks for the replies!

I managed to figure out what to do finally :)

I just added a line GUICtrlsetState(Inputbox,$GUI_Focus) before each Set Data.

Like this in the function:

Func Combo13Change() ;No Monitors
IniWrite($IniDir,"Config","Combo13",GUICtrlRead($Combo13))
If GUICtrlRead($Combo13) = "1" Then
    GUICtrlSetState($Input1,$GUI_Focus)
GUICtrlSetData($Input1,$X0,"0")
    GUICtrlSetState($Input2,$GUI_Focus)
GUICtrlSetData($Input2,$X1,"1916")
    GUICtrlSetState($Input3,$GUI_Focus)
GUICtrlSetData($Input3,$X2,"3836")
ElseIf GUICtrlRead($Combo13) = "2" Then
    GUICtrlSetState($Input1,$GUI_Focus)
GUICtrlSetData($Input1,$XM1,"-1924")
    GUICtrlSetState($Input2,$GUI_Focus)
GUICtrlSetData($Input2,$X0,"-4")
    GUICtrlSetState($Input3,$GUI_Focus)
GUICtrlSetData($Input3,$X1,"1916")
ElseIf GUICtrlRead($Combo13) = "3" Then
    GUICtrlSetState($Input1,$GUI_Focus)
GUICtrlSetData($Input1,$XM2,"-3836")
    GUICtrlSetState($Input2,$GUI_Focus)
GUICtrlSetData($Input2,$XM1,"-1924")
    GUICtrlSetState($Input3,$GUI_Focus)
GUICtrlSetData($Input3,$X0,"-4")
EndIf

EndFunc

 

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