Ich mache gerade einen Taschenrechner.
Meine Frage ist:
Wie kann ich das machen, das das Inputfeld (1) immer im Focus bleibt (==> kein $gui_focus, da ie davorige eingabe dann makiert ist und diese dann bei der nächsten Eingabe verschwindet).
Es sollte also immer nur der Kursor blinken.
Hier der bisherige Source:
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ListViewConstants.au3>
#Include <GuiListView.au3>
#include<misc.au3>
#Region ### START Koda GUI section ### Form=C:\Dokumente und Einstellungen\Sebastian\Desktop\autoit\calcer\calc.kxf
$Form1 = GUICreate("Calcer", 633, 449, 330, 233)
$ListView1 = GUICtrlCreateListView("Aufgabe|Ergebnis", 8, 8, 617, 153, BitOR($LVS_SINGLESEL,$LVS_SHOWSELALWAYS))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 300)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 300)
$Input1 = GUICtrlCreateInput("", 8, 224, 481, 21)
$Button1 = GUICtrlCreateButton("=", 496, 224, 105, 25, $BS_DEFPUSHBUTTON)
$Button2 = GUICtrlCreateButton("Alle Einträge löschen", 432, 168, 161, 33, $WS_GROUP)
$Button3 = GUICtrlCreateButton("Ausgewählten Eintrag löschen", 16, 168, 177, 33, $WS_GROUP)
$Input2 = GUICtrlCreateInput("0", 136, 264, 353, 21,$es_readonly)
$Label1 = GUICtrlCreateLabel("Aktuelles Ergebnis:", 16, 264, 113, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button4 = GUICtrlCreateButton("1", 104, 312, 57, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("2", 168, 312, 57, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("3", 240, 312, 57, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("4", 104, 344, 57, 25, $WS_GROUP)
$Button8 = GUICtrlCreateButton("5", 168, 344, 57, 25, $WS_GROUP)
$Button9 = GUICtrlCreateButton("6", 240, 344, 57, 25, $WS_GROUP)
$Button10 = GUICtrlCreateButton("7", 104, 376, 57, 25, $WS_GROUP)
$Button11 = GUICtrlCreateButton("8", 168, 377, 57, 23, $WS_GROUP)
$Button12 = GUICtrlCreateButton("9", 240, 376, 57, 25, $WS_GROUP)
$Button15 = GUICtrlCreateButton("0", 104, 408, 193, 25, $WS_GROUP)
$Button16 = GUICtrlCreateButton("+", 384, 304, 65, 41, $WS_GROUP)
$Button17 = GUICtrlCreateButton("*", 456, 304, 65, 41, $WS_GROUP)
$Button18 = GUICtrlCreateButton("-", 384, 352, 65, 41, $WS_GROUP)
$Button19 = GUICtrlCreateButton("/", 456, 352, 65, 41, $WS_GROUP)
$Button20 = GUICtrlCreateButton("=", 384, 400, 137, 41, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button4
GUICtrlSetData($input1,guictrlread($input1)&"1")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button5
GUICtrlSetData($input1,guictrlread($input1)&"2")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button6
GUICtrlSetData($input1,guictrlread($input1)&"3")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button7
GUICtrlSetData($input1,guictrlread($input1)&"4")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button8
GUICtrlSetData($input1,guictrlread($input1)&"5")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button9
GUICtrlSetData($input1,guictrlread($input1)&"6")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button10
GUICtrlSetData($input1,guictrlread($input1)&"7")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button11
GUICtrlSetData($input1,guictrlread($input1)&"8")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button12
GUICtrlSetData($input1,guictrlread($input1)&"9")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button15
GUICtrlSetData($input1,guictrlread($input1)&"0")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button16
GUICtrlSetData($input1,guictrlread($input1)&"+")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button17
GUICtrlSetData($input1,guictrlread($input1)&"*")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button18
GUICtrlSetData($input1,guictrlread($input1)&"-")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button19
GUICtrlSetData($input1,guictrlread($input1)&"/")
GUICtrlSetData($input2,Execute(guictrlread($input1)))
case $Button20
$tit=GUICtrlCreateListViewItem(guictrlread($input1)&"|"&Execute(guictrlread($input1)),$listview1)
GUICtrlSetState($tit,$GUI_FOCUS)
GUICtrlSetData($input2,"")
GUICtrlSetData($input1,"")
case $Button1
$exe = Execute(guictrlread($input1))
if $exe = "9223372036854775807" then
GUICtrlSetData($input2,"Zahl ist zu groß.")
GUICtrlCreateListViewItem(guictrlread($input1)&"|"&guictrlread($input2),$listview1)
GUICtrlSetData($input2,"")
GUICtrlSetData($input1,"")
Else
guictrlsetdata($input2,$exe)
GUICtrlCreateListViewItem(guictrlread($input1)&"|"&guictrlread($input2),$listview1)
GUICtrlSetData($input2,"")
GUICtrlSetData($input1,"")
endif
case $Button2
_GUICtrlListView_DeleteAllItems($ListView1)
case $Button3
GUICtrlDelete(GuiCtrlRead($listview1))
EndSwitch
sleep(1)
$exe = Execute(guictrlread($input1))
if $exe = "9223372036854775807" then
GUICtrlSetData($input2,"Zahl ist zu groß.")
Else
GUICtrlSetData($input2,$exe)
endif
WEnd