theolonghair

Combobox strings to give editbox data

13 posts in this topic

#1 ·  Posted (edited)

Hello, Hereby I'd like to ask for the devs proffesional help cause there is
something I can not get to work. I have an Combobox containing 3 strings.
When I choose one, I'd wish for the 'readonly'editbox to hold some data from
each string, a different data.

string 1-> GUICtrlEdit /Edit1 : data ; blabla
string 2-> GUICtrlEdit /Edit1  : data ; random typin
string 3-> GUICtrlEdit /Edit1 : data ; other info

Just to give an example

I have a hunge it has something to do with
Case
$Combo1,
GuiCtrlSetData
and a read command.

I shall provide a KodaForm generated code script.au3 below but I'm kinda lost in how to get it done.
If only I had the beginning from one of the strings I'd make the ones for the other strings myself.

Kind regards Theo Van Der Wal, Frieschepalen, Holland
 

 

theolonghair.au3

Edited by theolonghair
added info and example

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I looked in your script and this line:

GUICtrlSetData(-1, "Lightning Gun|Rocket Launcher|Rail Gun")

shows me: unfortunately you appear to have missed the Forum rules on your way in, or is the reality and the army of Absurdistan wants to automate her weapons?

Edited by AutoBert

Share this post


Link to post
Share on other sites

So, I violated a rule? :(
Please be specific cause it is not my intention I want to make something that
violates the user rules of a game; quake live I merely wanted to make a user friendly
overall program that holds specific info of practice routines in that game with 3 main
weapons, hence the Combobox strings. Roughly said the editbox would contain guidelines
of practice offline.
I can imagine you think the way you are thinking right now, and it looks like my word against yours...
In which Case you have the last word, cause you have an somewhat authority here of which I am
aware of. So yes, If you don't trust it than ofcourse by all means do not help me progress with my help file.
Otherwise I'd much appreciate the question answered in my first post.

Kind regards Theo van der Wal. Holland.

Share this post


Link to post
Share on other sites

theolonghair,

Autobert has no authority here - but I do.

As you describe the script:

user friendly
overall program that holds specific info of practice routines in that game with 3 main
weapons, hence the Combobox strings. Roughly said the editbox would contain guidelines
of practice offline.

I judge that this is a permissible thread, so I am leaving it open for the moment.

However, I recommend that you read the Forum rules before you post again just to make sure that in the future you keep away from anything that might infringe them.

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
Share on other sites

I judge that this is a permissible thread, so I am leaving it open for the moment.

However, I recommend that you read the Forum rules before you post again just to make sure that in the future you keep away from anything that might infringe them.

M23

 

First off, I thank you very much Melba23, for giving me the chance to proof my intentions.
I feel priveledged.
I can keep my progress updated here.
And I could even show the final results to several devs of the forums on quake live.

Just to correspond and verify it is an helpful, all in one tutorial interface.
I most certain feel obligated to go through the forum rules as you mentioned. I should have before hand. I know.

w k regards  Theo van der Wal Frieschepalen Holland.

Share this post


Link to post
Share on other sites

theolonghair,

This is how you react to a combo  selection:

#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <MsgBoxConstants.au3>

Opt("GUIOnEventMode", 1)

$Form1_1 = GUICreate("Form1", 901, 601, 183, 114)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1_1Close")

$Tab1 = GUICtrlCreateTab(0, 0, 436, 404)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")

$Edit1 = GUICtrlCreateEdit("", 8, 48, 208, 200, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))
GUICtrlSetData(-1, "Edit1")
$Combo1 = GUICtrlCreateCombo("", 56, 24, 161, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Lightning Gun|Rocket Launcher|Rail Gun")
GUICtrlSetOnEvent($Combo1, "_Combo")
$Label1 = GUICtrlCreateLabel("Weapon", 8, 27, 45, 17)

$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
$TabSheet4 = GUICtrlCreateTabItem("TabSheet4")
GUICtrlCreateTabItem("")

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd



Func _Combo()
    MsgBox($MB_SYSTEMMODAL, "Cobo Selection", GUICtrlRead($Combo1))
EndFunc



Func Form1_1Close()
    Exit
EndFunc

What do you want to happen to the edit when a selection is made?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
Share on other sites

$Edit1 = GUICtrlCreateEdit("", 8, 48, 208, 200, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))

The edit to get some text.
Each combobox Tstring has its own different text´ for the Edit.
So when a string is selected the editbox "show some text corresponding to the string.

Thanks by the way for your time!

 

Share this post


Link to post
Share on other sites

theolonghair,

The edit to get some text.

That much I could guess.....

So from where do you get this text, based on the combo selection? From a file? From a website? Help us to help you by giving us the details of what you are trying to achieve.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I prefer that text would be in the script itself, but if that is impossible,
Than a file(notepad.txt*) would be the next best thing.

string one text.txt

Edited by theolonghair

Share this post


Link to post
Share on other sites

theolonghair,

We do not just write code for you - what have you tried yourself?

You can easily store text within a script - it is far from impossible. Just assign it to a variable.

Reading from a file is also not difficult - have you looked in the Help file for a suitable function? FileRead would seem a likely candidate.....

Do some work yourself and we will help you work through any problems - just do not expect us to do it all.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

You are right in that,
I'll continue my way through the help file.  
Can take some time ofc.
I rest my case on the forum for now

Thank you :)

string one text.txt

Edited by theolonghair

Share this post


Link to post
Share on other sites

Melba, may I ? for a clue only  :)

As there are several ways to achieve this, one simple and secure is the use of a hardcoded 2D array

Global $data[3][2] = [ _
                    ["Lightning Gun", "data1 LG"], _ 
                    ["Rocket Launcher", "data2 RL"], _ 
                    ["Rail Gun", "data3 RG"] ]

 

Share this post


Link to post
Share on other sites

To answer your question to what I've done for myself

I got 2 books from the play store  about autoIt^^
Had to buy it though but reading them whenever I have the time is bearing fruit.
Thanks for your input, Mikell.

I recently made something that applied to my job.
I do have few images that should be within the GUI,
but I have to figure out how to keep the images in the GUI
so currently I can't show the result compared to what I've got on my pc.
(I've read about this in the books I downloaded/ bought ie; installer paths)..

The Tabs hold the info of which specific product we process,
Below the Edit holds the raw materials we extract from the product\Tab selected.
Nothing is really automated but I felt fulfilled I came that far.
-starting with a form
-making tabs
-making editboxes
-fitting images.

And yes I want to figure things out myself, apologies if I went a little off-topic but
I felt a little obliged to show you this. this upload was just for show and tell.

Greetings theo van der Wal.

 

dopjes.jpg

Van Gansewinkel Groep.au3

waterbakpuin.jpg

Van Gansewinkel Groep.exe

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

  • Similar Content

    • rootx
      By rootx
      I hope someone explain me how to do that... well, if you run the command netstat -a inside cmd prompt he look nice( indented ) but if you try to show the output inside the GUICtrlCreateEdit he look without indentation... how can I  fix it? Thx
      $Pid = Run(@ComSpec & " /c " & "netstat -a",@ScriptDir,@SW_HIDE,$STDERR_CHILD + $STDOUT_CHILD) Dim $_StderrRead='', $_StdoutRead='', $_StdReadAll='' While ProcessExists ( $Pid ) $_StderrRead = StderrRead ( $Pid ) If Not @error And $_StderrRead <> '' Then GUICtrlSetData($Edit1, "Error: " & $_StderrRead & @Crlf ,1) EndIf $_StdoutRead = StdoutRead ( $Pid ) If Not @error And $_StdoutRead <> '' Then GUICtrlSetData($Edit1, "Log: " & $_StdoutRead & @Crlf ,1) EndIf Wend  
    • rootx
      By rootx
      How can I write a good output inside Edit control?
       4 example on notepad (windows) he looks terrible... but he looks perfect on notepad++ and cmd. THX
      GUICtrlSetData($Edit1, "Log: " & $_StdoutRead & @Crlf ,1) the log..
      <snip>
    • kashamalasha
      By kashamalasha
      Hello.
      Could you help me find the answer for my issue. I'm trying to set fomatted data wich is selected from SQL to GUICtrlCreateEdit field.
      And the GUICtrlSetData function is inserting it in one line. But when I'm trying to do the same using MsgBox the data looks fine.
      I'm trying to not use _GUICtrlRichEdit UDF.
      Thanks in advance. Here is my test code.
      #include <GUIConstants.au3> #include <GUIListBox.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Opt("GUIOnEventMode", 1) $hMainGUI = GUICreate("Test", 520, 240) $hListBox = _GUICtrlListBox_Create($hMainGUI, "", 10, 10, 180, 80) $hEdit = GUICtrlCreateEdit("", 10, 80, 500, 150) GUISetState(@SW_SHOW, $hMainGUI) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Local $hQuery, $aRow _SQLite_Startup() $hDB = _SQLite_Open('MyDB.sqlite') _SQLite_Query(-1, "SELECT ID ||"". "" || Name FROM Templates ORDER BY ID;", $hQuery) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK _GUICtrlListBox_AddString($hListBox, $aRow[0]) WEnd GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_Button") While 1 Sleep(100) WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hListBox, $hWndListBox Switch $iCode Case $LBN_DBLCLK Select_Template(_GUICtrlListBox_GetCurSel($hListBox) + 1) Return 0 EndSwitch EndSwitch EndFunc ;==>_WM_COMMAND Func CLOSE_Button() _SQLite_Close() _SQLite_Shutdown() Exit EndFunc ;==>CLOSE_Button Func Select_Template($sListItem) _SQLite_QuerySingleRow($hDB, _ "SELECT Content " & _ "FROM Templates " & _ "WHERE ID = " & $sListItem & ";", $aRow) ;~ MsgBox(64, "Test: " & $sListItem, $aRow[0]) GUICtrlSetData($hEdit, $aRow[0]) WinSetTitle($hMainGUI, "", "Test: " & $sListItem) EndFunc ;==>Select_Template  


    • Simpel
      By Simpel
      Hi,
      I'm trying to create a console reader. All is working but I have a problem with the look. I want the line numbers with another backgroundcolor in silver. I made this with a small silver label. The edit control over the label has a transparent background.
      But if I start the prog then i can see how the line numbers wipe the silver background off. And if I click into the Edit then the silver label disappears completely.
      #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) Global $g_iZaehler = 0 Global $g_hGUI = GUICreate("Console: StdoutRead" , 800, 800, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPCHILDREN, $WS_EX_ACCEPTFILES) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Global $text = GUICtrlCreateEdit("",10,30,780,760, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_READONLY + $ES_NOHIDESEL) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKBORDERS) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) Global $g_LaZeilen = GUICtrlCreateLabel("Zeilen: " & StringFormat("% 5d", $g_iZaehler), 680, 10, 100, 9, $SS_LEFTNOWORDWRAP) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKSIZE) Global $g_hCbFreeze = GUICtrlCreateCheckbox("&Freeze", 13, 5, 90) GUICtrlSetFont(-1, 9, -1, -1, "Lucida Console") GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlCreateLabel("", 11, 31, 42, 758) ; soll die Ziffern andersfarbig hinterlegen GUICtrlSetBkColor(-1, $COLOR_SILVER) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH) GUISetState(@SW_SHOW) Global $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) While 1 Sleep(200) $g_iZaehler += 1 $sText = StringFormat("% 5d", $g_iZaehler) & @CRLF _GUICtrlEdit_AppendText($text, $sText) WEnd Func _Exit() Exit EndFunc Do you have any suggestions.
      Regards, Conrad
    • PINTO1927
      By PINTO1927
      Hi guys,
      I would like to implement the words in GuiCtrlCreateEdit through the choices the GuiCtrlCreateCombo. Each item in the GuiCtrlCreateCombo must contain the words that are to be reported later in the GuiCtrlCreateEdit. I have attached an example , I added just a GuiCtrlCreateCombo , then it will insert more.
      Thanks for the attention