Jump to content
Sign in to follow this  
shornw

Completely new to GUI stuff

Recommended Posts

shornw

Hi all

Sorry to be such a feeb but I am completely new to GUI work and need a bit of a kickstart,

I aim to use it more now as my role is changing and it will be really useful but I am trying to get my head round a few things. Can someone possibly offer the correct code to make buttons work and explain HOW it works.

For example as a simple test I tried to create a short, user friendly GUI Net Send but I cant work out quite how to read the text entered or how to make the Cancel button work (Really feeble I know but I'm a very green programmer :P )

Here is where I got to:

CODE
#include <process.au3>

#include <GuiConstants.au3>

$1 = "Fred"

$2 = "Bill"

; GUI

GuiCreate("GUI Messaging", 300, 210)

GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

; COMBO

$User = GuiCtrlCreatecombo("Select user", 20, 20, 80, 50)

GUICtrlSetData(-1,$1&"|"&$2, "item3")

; INPUT

$text = GuiCtrlCreateInput("Enter text", 20, 55, 250, 80, $ES_MULTILINE )

; BUTTONS

$send = GuiCtrlCreateButton("Send", 20, 150, 60, 30)

$exit = GuiCtrlCreateButton("Cancel", 100, 150, 60,30)

GUISetState ()

$msg = 0

While GuiGetMsg() <> $GUI_EVENT_CLOSE

WEnd

;_RunDOS("net send " & $user & " " & $text)

thanks for any help


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Share this post


Link to post
Share on other sites
Valuater

#include <process.au3>
#include <GuiConstants.au3>

$1 = "Fred" 
$2 = "Bill" 

; GUI
GUICreate("GUI Messaging", 300, 210)
GUISetIcon(@SystemDir & "\mspaint.exe", 0)

; COMBO
$User = GUICtrlCreateCombo("Select user", 20, 20, 80, 50)
GUICtrlSetData(-1, $1 & "|" & $2, "item3")

; INPUT
$text = GUICtrlCreateInput("Enter text", 20, 55, 250, 80, $ES_MULTILINE)

; BUTTONS
$send = GUICtrlCreateButton("Send", 20, 150, 60, 30)
$exit = GUICtrlCreateButton("Cancel", 100, 150, 60, 30)

GUISetState()
$msg = 0


While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Or $msg = $exit Then Exit
    
    If $msg = $send Then
        $read_Send = GUICtrlRead($User)
        $read_Text = GUICtrlRead($text)
        If $read_Send <> "" And $read_Text <> "" Then Send_It($read_Send, $read_Text)
    EndIf
    
WEnd

Func Send_It($iUser, $iText)
    ;_RunDOS("net send " & $user & " " & $text)

    MsgBox(0x0, $iUser, $iText)

EndFunc   ;==>Send_It

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
shornw

Thanks ever so much. This gives me an insight into how it works and I can make progress now

thanks again all


[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.