Jump to content

Completely new to GUI stuff


shornw
 Share

Recommended Posts

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]

Link to comment
Share on other sites

#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

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