Jump to content

Not an idea in the world how to do this


Recommended Posts

How can I make a simple GUI interface to have two input boxes basically giving Inputbox 1 Divided by Inputbox 2 +1

But for it to automatically update all the time when a new number is added so it constantly refrehes and no need to press enter.

Link to comment
Share on other sites

What do you have so far? Perhaps look at OnEventMode if you don't want to manually poll the text boxes. Also use a descriptive topic name. Don't input boxes pop up while text boxes are found on GUIs?

Edited by qazwsx
Link to comment
Share on other sites

Something like this - not tested

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

;Opt('MustDeclareVars', 1)

Example1()

; example 1
Func Example1()
    Local $msg

    GUICreate("My GUI")  ; will create a dialog box that when displayed is centered
    $one = GUICtrlCreateInput('1',0,0)
    $two = GUICtrlCreateInput('1',0,20)
    $newnumber = GUICtrlCreateInput(GUICtrlRead($one)/GUICtrlRead($two) + 1,0,40)

    GUISetState(@SW_SHOW)       ; will display an empty dialog box

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        GUICtrlSetData($newnumber,GUICtrlRead($one)/GUICtrlRead($two) + 1)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        sleep(100)
    WEnd
    GUIDelete()
EndFunc   ;==>Example1

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

Something like this - not tested

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

;Opt('MustDeclareVars', 1)

Example1()

; example 1
Func Example1()
    Local $msg

    GUICreate("My GUI")  ; will create a dialog box that when displayed is centered
    $one = GUICtrlCreateInput('1',0,0)
    $two = GUICtrlCreateInput('1',0,20)
    $newnumber = GUICtrlCreateInput(GUICtrlRead($one)/GUICtrlRead($two) + 1,0,40)

    GUISetState(@SW_SHOW)       ; will display an empty dialog box

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        GUICtrlSetData($newnumber,GUICtrlRead($one)/GUICtrlRead($two) + 1)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        sleep(100)
    WEnd
    GUIDelete()
EndFunc   ;==>Example1oÝ÷ Ûú®¢×­©äÊ¢¼¨º¼(׫~éazZR¡ö«"¯y«­¢+Ø¥¹±Õ±Ðí¥Ñ
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±ÐíU%
½¹ÍѹÑÍà¹ÔÌÐì(¥¹±Õ±ÐíMÑÑ¥
½¹ÍѹÑ̹ÔÌÐì(¥¹±Õ±Ðí]¥¹½ÝÍ
½¹ÍѹÑ̹ÔÌÐì(9½QÉå%½¸()A ¤)Õ¹A ¤(1½°ÀÌØíµÍ(ÀÌØíAôU%
ÉÑ ÅÕ½ÐíIå¸ÌäíÌMÉ¥ÁÐÅÕ½Ðì°ÈÀÀ°ØÔ°ÈÀÀ°ÄÄÔ¤(ÀÌØí9Õ´ÄôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÄÈÅÕ½Ðì°à°à°ÐÀ°ÈÀ¤(ÀÌØí9Õ´ÈôU%
Ñɱ
ÉÑ%¹ÁÕÐ ÅÕ½ÐìÄÅÕ½Ðì°ÜÀ°à°ÐÀ°ÈÀ¤(ÀÌØí¹ÍÝÈôU%
Ñɱ
ÉÑ%¹ÁÕСU%
ÑɱI ÀÌØí9մĤ½U%
ÑɱI ÀÌØí9մȤ¬Ä°ÄÌÔ°à°ÔÀ°ÈÀ¤)U%
ÑɱMÑ   ­
½±½È ´Ä°ÁàÀÁ¤)U%
ÑɱMÑ1¥µ¥Ð ´Ä°Ô¤(ÀÌØíôU%
Ñɱ
ÉÑ1° ÅÕ½Ðì¼ÅÕ½Ðì°ÔÔ°ÄÔ°ÄÀ°ÄÔ¤(ÀÌØíôU%
Ñɱ
ÉÑ1° ÅÕ½ÐìôÅÕ½Ðì°ÄÈÀ°ÄÔ°ÄÀ°ÄÔ¤(ÀÌØíá¥ÐôU%
Ñɱ
ÉÑ    ÕÑѽ¸ ÅÕ½Ðíá¥ÐÅÕ½Ðì°à°ÐÀ°ÄÜÜ°ÄÜ°ÀÌØí]M}I=U@¤)U%MÑMÑÑ¡M]}M!=¤((]¡¥±Ä(ÀÌØíµÍôU%Ñ5Í ¤(U%
ÑɱMÑÑ ÀÌØí¹ÍÝȱU%
ÑɱI ÀÌØí9մĤ½U%
ÑɱI ÀÌØí9մȤ¬Ä¤(%ÀÌØíµÍôÀÌØíU%}Y9Q}
1=MQ¡¸á¥Ñ1½½À(ͱÀ ÄÀÀ¤(%
ÍÀÌØíá¥Ð($%á¥Ð(]¹(U%±Ñ ¤)¹Õ¹

I can't get an exit button to implement :|

Link to comment
Share on other sites

thank you for your wonderful help.

So far I have:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon

PD()
Func PD()
    Local $msg
$PD = GUICreate("Ryan's Script", 200, 65, 200, 115)
$Num1 = GUICtrlCreateInput("12", 8, 8, 40, 20)
$Num2 = GUICtrlCreateInput("1", 70, 8, 40, 20)
$Answer = GUICtrlCreateInput(GUICtrlRead($Num1)/GUICtrlRead($Num2) + 1, 135, 8, 50, 20)
GUICtrlSetBkColor(-1, 0x00FFFF)
GUICtrlSetLimit(-1, 5)
$a = GUICtrlCreateLabel("/", 55, 15, 10, 15)
$b = GUICtrlCreateLabel("=", 120, 15, 10, 15)
$Exit = GUICtrlCreateButton("Exit", 8, 40, 177, 17, $WS_GROUP)
GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        GUICtrlSetData($answer,GUICtrlRead($Num1)/GUICtrlRead($Num2) + 1)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        sleep(100)
    Case $Exit
        Exit
    WEnd
    GUIDelete()
EndFunc

I can't get an exit button to implement :|

XxXGoD, there is no way that script will run, you must know it so saying that you can't get the exit button to work is just silly and you shouldn't waste your time and ours by even posting it IMO.
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.
Link to comment
Share on other sites

Martin, thats is a copy of the script when I was adding the exit button this was the working one, I was showing that I was trying to get it going...

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#NoTrayIcon

PD()
Func PD()
    Local $msg
$PD = GUICreate("Ryans Script - Thanks nitekram", 290, 35, 200, 110)
$Num1 = GUICtrlCreateInput("12", 8, 8, 40, 20)
GUICtrlSetLimit(-1, 5)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Num2 = GUICtrlCreateInput("1", 70, 8, 40, 20)
GUICtrlSetLimit(-1, 5)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Answer = GUICtrlCreateInput(GUICtrlRead($Num1)/GUICtrlRead($Num2) + 1, 135, 8, 135, 20)
GUICtrlSetLimit(-1, 5)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$a = GUICtrlCreateLabel("/", 55, 15, 10, 15)
$b = GUICtrlCreateLabel("=", 120, 15, 10, 15)
GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        GUICtrlSetData($answer,GUICtrlRead($Num1)/GUICtrlRead($Num2) + 1)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        sleep(100)
    WEnd
    GUIDelete()
EndFunc

Snowmaker, that doesn't work for me :|

It says undefined varible, I am using obviously _GUICtrlEdit_GetLimitText aswel.. but still nothing

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