Jump to content

list text-button-editbox


sw00n
 Share

Recommended Posts

Update*...

#include <GUIConstantsEx.au3>
#include <INet.au3>
#include <GuiButton.au3>
#include <GuiToolBar.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>

$parent = GUICreate("1up Shader Maker v.3", 500, 225, 269, 216)
$input1 = GUICtrlCreateInput("Textures/Path here/Name here", 7, 25, 160, 20)
$label1 = GUICtrlCreateLabel("Texture Path: ", 6, 10, 250, 15)
$menu1 = GUICtrlCreateMenu("File")
$open = GUICtrlCreateMenuItem("Open", $menu1)
$save = GUICtrlCreateMenuItem("Save As", $menu1)
$exit = GUICtrlCreateMenuItem("Exit", $menu1)
$common = GUICtrlCreateMenu("Common")
$shaders = GUICtrlCreateMenuItem("Common Shaders", $common)
$help1 = GUICtrlCreateMenu("Help")
$help = GUICtrlCreateMenuItem("Help", $help1)
$about = GUICtrlCreateMenuItem("About...", $help1)
$edit1 = GUICtrlCreateEdit("", 200, 25, 290, 150)
$button1 = GUICtrlCreateButton("Add", 120, 60, 75, 25)
$button2 = GUICtrlCreateButton("Remove", 120, 95, 75, 25)
$clear = GUICtrlCreateButton("Clear", 120, 130, 75, 25)
Global $List1 = GUICtrlCreateList("", 7, 60, 100, 100)
GUICtrlSetData(-1, "Caulk|AreaPortal|Cushion|Slick|Hint|PlayerClip|NoDraw|NoDrop|Origin|Trigger|MirrorSurface", "AreaPortal")
GUISetState(@SW_SHOW)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $exit
            exit1()
        Case $help
            help()
        Case $open
            open1()
        Case $save
            save()
        Case $shaders
            GUISetState(@SW_DISABLE, $parent)
            shaders($parent)
            ; Re-enable the first GUI
            GUISetState(@SW_ENABLE, ($parent))
        Case $about
            GUISetState(@SW_DISABLE, $parent)
            about($parent)
            ; Re-enable the first GUI
            GUISetState(@SW_ENABLE, ($parent))
    EndSwitch
WEnd

Func help()
    MsgBox(0, "", "Enter the path or your texture, default is: textures/Name Here/Name Here")
EndFunc   ;==>help

Func exit1()
    MsgBox(0, "Exiting", "Now Exiting...", 2)
    Exit
EndFunc   ;==>exit1

Func open1()
    $message = ("Only Open Shaders and Text Files")
    $var = FileOpenDialog($message, @ScriptDir & "\", "List (*.shader)")
    $file = FileRead($var)
    If @error Then
        MsgBox(0, "", "No File(s) were selected")
    Else
        GUICtrlSetData($edit1, $file)
    EndIf
EndFunc   ;==>open1

Func save()

    $file = FileSaveDialog("Must save as .shader", @ScriptDir, "Text Files (.shader)|All Files (*.*)", 18, "*.shader")
    $xFile = FileOpen($file, 8 + 2)
    FileWrite($xFile, GUICtrlRead($edit1))

EndFunc   ;==>save

Func shaders($parent)
    GUICreate("Common Textures List", 500, 210, 269, 216, -1, -1, $parent)
    $menu1 = GUICtrlCreateMenu("File")
    $exit = GUICtrlCreateMenuItem("Exit", $menu1)
    $Home1 = GUICtrlCreateMenu("Home")
    $shaders = GUICtrlCreateMenuItem("Home", $Home1)
    GUISetState(@SW_SHOW)
EndFunc   ;==>shaders

Func about($parent)
    GUICreate("1up Shader Maker - About", 200, 190, 616, 406, -1, -1, $parent)
    $menu1 = GUICtrlCreateMenu("File")
    $exit = GUICtrlCreateMenuItem("Exit", $menu1)
    $Home1 = GUICtrlCreateMenu("Home")
    $shaders = GUICtrlCreateMenuItem("Home", $Home1)
    $label2 = GUICtrlCreateLabel("Application name: 1up Shader Maker", 7, 23, 189, 15)
    $label3 = GUICtrlCreateLabel("Version: .v1", 8, 52, 112, 15)
    $label4 = GUICtrlCreateLabel("website: http://1upclan.info", 8, 77, 194, 15)
    GUISetState(@SW_SHOW)
EndFunc   ;==>about

Func button1()

EndFunc   ;==>button1

Func button2()
EndFunc   ;==>button2

Edited by sw00n
Link to comment
Share on other sites

Add Case statements for $button1 and $button2 to your Switch handling for GuiGetMsg().

GuiCtrlRead() can tell you if "Caulk" is selected in the $List1 List control, and also read the current contents of the Edit control.

GuiCtrlSetData() or ControlSetText() can set the text in the Edit control.

What else did you need?

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

ok i got the List to show properly with all the text

Global $List1 = GUICtrlCreateList("", 7, 60, 100, 100)
GUICtrlSetData(-1, "Caulk|AreaPortal|Cushion|Slick|Hint|PlayerClip|NoDraw|NoDrop|Origin|Trigger|MirrorSurface", "AreaPortal")
GUISetState(@SW_SHOW)

Now i have to set those text to send another "text" into the editbox when i press the "Add" button...

But i have no idea how to do that :graduated:

Edited by sw00n
Link to comment
Share on other sites

Thanks for pm :graduated:

Please explain a little more what you want to do and I will have a look after lunch.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Randomly PMing everyone around won't obviously get more attention focused on your issue. Others have already asked you to explain a bit more clearly what your actual problem(s) is/are.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

OK, I would say an array to keep track of the text strings associated with each list entry:

1. When either Add or Remove are clicked, you use GuiCtrlRead() to see what is selected in the List.

2. Use that selection to find the text string associated with it from the array.

3. Use GuiCtrlRead() to get the current contents of the Edit control as a string.

4. Do string manipulation to add/remove the selected text (i.e. with StringReplace()).

5. Apply the modified string to the Edit control.

6. ???

7. Profit!

8. Send PsaltyDS 10% of gross...

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Moderators

sw00n,

Looks like you have enough brainpower here so I am not bothering to look. :graduated:

Leave me off the distribution list next time - or better still, do what I suggested in the reply to your PM and do not send any more asking for help. :(

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

this is not 100%, but I think it gives you a start.

#include <GUIConstantsEx.au3>
#include <INet.au3>
#include <GuiButton.au3>
#include <GuiToolBar.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>

$parent = GUICreate("1up Shader Maker v.3", 500, 225, 269, 216)
$input1 = GUICtrlCreateInput("Textures/Path here/Name here", 7, 25, 160, 20)
$label1 = GUICtrlCreateLabel("Texture Path: ", 6, 10, 250, 15)
$menu1 = GUICtrlCreateMenu("File")
$open = GUICtrlCreateMenuItem("Open", $menu1)
$save = GUICtrlCreateMenuItem("Save As", $menu1)
$exit = GUICtrlCreateMenuItem("Exit", $menu1)
$common = GUICtrlCreateMenu("Common")
$shaders = GUICtrlCreateMenuItem("Common Shaders", $common)
$help1 = GUICtrlCreateMenu("Help")
$help = GUICtrlCreateMenuItem("Help", $help1)
$about = GUICtrlCreateMenuItem("About...", $help1)
$edit1 = GUICtrlCreateEdit("", 200, 25, 290, 150)
$add_B = GUICtrlCreateButton("Add", 120, 60, 75, 25)
$remove_B = GUICtrlCreateButton("Remove", 120, 95, 75, 25)
$clear = GUICtrlCreateButton("Clear", 120, 130, 75, 25)
Global $List1 = GUICtrlCreateList("", 7, 60, 100, 100)
GUICtrlSetData(-1, "Caulk|AreaPortal|Cushion|Slick|Hint|PlayerClip|NoDraw|NoDrop|Origin|Trigger|MirrorSurface", "AreaPortal")
GUISetState(@SW_SHOW)


While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $exit
            exit1()
        Case $help
            help()
        Case $open
            open1()
        Case $save
            save()
        Case $shaders
            GUISetState(@SW_DISABLE, $parent)
            shaders($parent)
            ; Re-enable the first GUI
            GUISetState(@SW_ENABLE, ($parent))
        Case $about
            GUISetState(@SW_DISABLE, $parent)
            about($parent)
            ; Re-enable the first GUI
            GUISetState(@SW_ENABLE, ($parent))
        Case $add_B
            _add()
        Case $remove_B
            _remove()
    EndSwitch
WEnd


Func _add()
    GUICtrlSetData($edit1, GUICtrlRead($edit1) & GUICtrlRead($List1) & @crlf)
EndFunc   ;==>_add

Func _remove()
    GUICtrlSetData($edit1, StringReplace(GUICtrlRead($edit1), GUICtrlRead($List1), ''))
EndFunc   ;==>_remove

Func help()
    MsgBox(0, "", "Enter the path or your texture, default is: textures/Name Here/Name Here")
EndFunc   ;==>help

Func exit1()
    MsgBox(0, "Exiting", "Now Exiting...", 2)
    Exit
EndFunc   ;==>exit1

Func open1()
    $message = ("Only Open Shaders and Text Files")
    $var = FileOpenDialog($message, @ScriptDir & "\", "List (*.shader)")
    $file = FileRead($var)
    If @error Then
        MsgBox(0, "", "No File(s) were selected")
    Else
        GUICtrlSetData($edit1, $file)
    EndIf
EndFunc   ;==>open1

Func save()

    $file = FileSaveDialog("Must save as .shader", @ScriptDir, "Text Files (.shader)|All Files (*.*)", 18, "*.shader")
    $xFile = FileOpen($file, 8 + 2)
    FileWrite($xFile, GUICtrlRead($edit1))

EndFunc   ;==>save

Func shaders($parent)
    GUICreate("Common Textures List", 500, 210, 269, 216, -1, -1, $parent)
    $menu1 = GUICtrlCreateMenu("File")
    $exit = GUICtrlCreateMenuItem("Exit", $menu1)
    $Home1 = GUICtrlCreateMenu("Home")
    $shaders = GUICtrlCreateMenuItem("Home", $Home1)
    GUISetState(@SW_SHOW)
EndFunc   ;==>shaders

Func about($parent)
    GUICreate("1up Shader Maker - About", 200, 190, 616, 406, -1, -1, $parent)
    $menu1 = GUICtrlCreateMenu("File")
    $exit = GUICtrlCreateMenuItem("Exit", $menu1)
    $Home1 = GUICtrlCreateMenu("Home")
    $shaders = GUICtrlCreateMenuItem("Home", $Home1)
    $label2 = GUICtrlCreateLabel("Application name: 1up Shader Maker", 7, 23, 189, 15)
    $label3 = GUICtrlCreateLabel("Version: .v1", 8, 52, 112, 15)
    $label4 = GUICtrlCreateLabel("website: http://1upclan.info", 8, 77, 194, 15)
    GUISetState(@SW_SHOW)
EndFunc   ;==>about

Func button1()

EndFunc   ;==>button1

Func button2()
EndFunc   ;==>button2
Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

so im going to "take a break" from the forums, because of pming for help :graduated: which is what i thought this forums was for...

But i guess i'm frowned upon now, on these forums.

Thank you PsaltyDS and Xenobiologist for helping and answering me, i appreciate it.

Link to comment
Share on other sites

  • Moderators

sw00n,

You are not "frowned on" at all - just do not do it again! :graduated:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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