Jump to content
Sign in to follow this  
Syed23

Help with GUICtrlCreateEdit "Data"

Recommended Posts

Syed23

Hi All,

i have created a tool which will have GUICtrlCreateEdit. And i want to set the data as multiple line. So i hope i have used correct style for multiple lines. But my problem here i s couldn't break the data after writing every single line. For example, if i want to write the numbers from 1 to 50 on GUICtrlCreateEdit. The number should be set in Edit Box as one by one (like, first line should have onl the value 1 and second line should only have the value 2, and so on) i have tried some functions from Help file where i failed to find. Could someone can give some suggestions ?

Example code is here:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3> 
Opt('MustDeclareVars', 1)
 

Example()
 
 
Func Example()
                Local $myedit, $msg
 
                GUICreate("My GUI edit")  ; will create a dialog box that when displayed is centered
 
                $myedit =   ("" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN)
 
                GUISetState()
 
                Send("{END}")
 
                ; will be append dont' forget 3rd parameter
                For $i = 1 To 50 Step + 1
                GUICtrlSetData($myedit, $i, 0)
                Next
 
                ; Run the GUI until the dialog is closed
                While 1
                                $msg = GUIGetMsg()
 
                                If $msg = $GUI_EVENT_CLOSE Then ExitLoop
                WEnd
                GUIDelete()
EndFunc   ;==>Example

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
BrewManNH

This will allow you to have the output looking the way you want it.

For $i = 1 To 50 Step +1
        GUICtrlSetData($myedit, $i & @CRLF, 0); <<<<<<<<<<<<<<<< Change this line
    Next

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Syed23

This will allow you to have the output looking the way you want it.

For $i = 1 To 50 Step +1
        GUICtrlSetData($myedit, $i & @CRLF, 0); <<<<<<<<<<<<<<<< Change this line
    Next

:) ! Thanks a lot BrewManNH! Sure i might be an idiot. i have used this for lot of my codes but it doesn't triggered on my mind when it needed.. same on me :mellow:

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
Syed23

Hi BrewManNH,

i am getting struck with the same function. I could understand i am doing some mistake...but i don't know where i fail. Could you help me?

Here is my code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>#include "_XMLDomWrapper.au3"
#include"Array.au3"
Opt('MustDeclareVars', 1)

Global $file, $numberOfChannels , $Comment, $RegKey

Example() 


Func Example()
                Local $myedit, $msg

                GUICreate("My GUI edit")  ; will create a dialog box that when displayed is centered

                $myedit = GUICtrlCreateEdit  ("0"&@CRLF,  176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN)

                GUISetState()

                Send("{END}")

              $file = _XMLFileOpen(@DesktopDir &"\sample.xml") ; Here i am opening the XML File
        
            $numberOfChannels = _XMLGetNodeCount("/root/Application") ; I am counting the number of Application nodes
            For $s = 1 To $numberOfChannels Step +1
                $Comment = _XMLGetChildText("/root/Application[" & $s & "]/Name") ; getting the text of the node Name 
                $RegKey = _XMLGetChildText("/root/Application[" & $s & "]/Location")
            
                    If FileExists($RegKey[1]) Then
                        GUICtrlSetData($myedit, "Check Passed: " & $Comment[1] & @CRLF) ; The return value will be array so i am using $comment[1] 
                        GUICtrlSetColor($myedit, 0x008000)
                    Else
                        GUICtrlSetData($iMemo,"Check Failed: " & $Comment[1])
                        GUICtrlSetColor($iMemo, 0xFF0000)
                    EndIf
            Next
                
                ; Run the GUI until the dialog is closed
                While 1
                                $msg = GUIGetMsg()

                                If $msg = $GUI_EVENT_CLOSE Then ExitLoop
                WEnd
                GUIDelete()
EndFunc   ;==>Example

The actual problem is in the Edit box i am getting only the last value. All the previous values are getting overwrittened. What could be the fault i am doing :mellow:

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
Valuater

GUICtrlSetData ( controlID, data [, default] )

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate... function.

data Combo, List, ListView, ListViewItem: An Opt("GUIDataSeparatorChar",...) separated list of items.

Progress: The percentage.

Slider: The value.

Group, Label, Button, Checkbox, Radio, Combo, List, Input, Edit, TabItem, TreeViewItem: Replaces the text.

Date : The date or time depending the style of the control.

Dummy: The value.

default [optional] Combo, List: The default value.

Edit, Input: If non-empty (""), the string is inserted at the current insertion point (caret).

GUICtrlSetData ( $controlID, $data , 1 )

Should be.. the string is inserted at the current insertion point

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Syed23

GUICtrlSetData ( controlID, data [, default] )

Parameters

controlID The control identifier (controlID) as returned by a GUICtrlCreate... function.

data Combo, List, ListView, ListViewItem: An Opt("GUIDataSeparatorChar",...) separated list of items.

Progress: The percentage.

Slider: The value.

Group, Label, Button, Checkbox, Radio, Combo, List, Input, Edit, TabItem, TreeViewItem: Replaces the text.

Date : The date or time depending the style of the control.

Dummy: The value.

default [optional] Combo, List: The default value.

Edit, Input: If non-empty (""), the string is inserted at the current insertion point (caret).

GUICtrlSetData ( $controlID, $data , 1 )

Should be.. the string is inserted at the current insertion point

8)

wow... i have one basic doubt on GUI! i tried using lot of styles and Ex-styles from the Help file...but i know i am failing to pick the correct one. could you please tell me ?

What i wanted is in a GUI i wanted minimize option and maximize option but not the close(X button). How to do that? Sorry for asking such a silly question....


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
Valuater

I dont think that style is possible. But you can use EzSkin, XSkin or create your own custom GUI without a Title Bar and create a button for minimize by placing it in the top right corner.

EzSkin is here...

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Syed23

I dont think that style is possible. But you can use EzSkin, XSkin or create your own custom GUI without a Title Bar and create a button for minimize by placing it in the top right corner.

EzSkin is here...

8)

This is Awesome stuff... i have downloaded already :mellow:... but if we use this we may have to carry thin image where we run the exe rite? For example..whatever the tool i create i may distribute it to different region people... in this case i may need to carry this images as well rite? is there a way to create skin GUI without carrying it?


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
Syed23

Use FileInstall()

8)

:mellow: I am sorry this is first time i am using this function...need some understanding and practice.... let me try! so for trying it but successfully failing..:) ...anyway will keep on trying :)


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
Syed23

:mellow: I am sorry this is first time i am using this function...need some understanding and practice.... let me try! so for trying it but successfully failing..:) ...anyway will keep on trying :)

I don't think this fileinstall() helps me out... even if i compile... when i execute it as a EXE it searches for the file on the source location...

Look at this :

#include 
#include 

DirCreate("D:\temp")

FileInstall("C:\Documents and Settings\SaranyaMohan\Desktop\Skins\Universal\1.bmp","D:\temp\",1)

$EzGUI = EzSkinGUICreate("MyEzSkinDemo",750,550)
$EzIcon = EzSkinIcon($EzGUI)



$Button = EzSkinButton("EzSkin Button", 150, 150, 100, 30) ;, $font_color)

[img]C:\Documents%20and%20Settings\SaranyaMohan\Desktop\Skin.png[/img]
GUISetState()

While 1
    EzSkinOver()
    $msg = GUIGetMsg()
    If $msg = $EzIcon[1] Then Exit
    If $msg = $EzIcon[2] Then GuiSetstate(@SW_MINIMIZE, $EzGUI)
    If $msg = $Button Then MsgBox(64,"EzSkin", "The Skin is operating properly... Thanks    ")


WEnd

Note:

It copies the BMP but i am getting the error message "$skin folder not found"!

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites
Valuater

Maybe it would be easier for you to create a "zip" file to store all the exe and data needed.

8)

Edited by Valuater

NEWHeader1.png

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.