Jump to content

Problem with func - output 0?


Lisuter
 Share

Recommended Posts

Hello.

I have problem with my work...

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
Global $Input1 = GUICtrlCreateInput("", 8, 8, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 280, 32, 75, 25)
$Edit1 = GUICtrlCreateEdit("", 8, 88, 345, 145)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            editb()


    EndSwitch
WEnd

Func blanktoplus($aa)
 StringReplace(GuiCtrlRead($aa), " ", "+")
 Global $iReplacements = @extended
EndFunc

Func editb()
    Global $Edit1 = GUICtrlSetData(-1,"The full name is:" & blanktoplus($Input1))

EndFunc

 

On my form i have: 1x Input, 1x Button, 1x Edit

In input1 i have: Sara Oconnor.

I want after click button to set message in edit1 like this:

The full name is: Sara+Oconnor

Now i have: The full name is: 0

 

Where is the problem? Thanks!

Link to comment
Share on other sites

  • Moderators

Why not just run your function like this rather than trying to pull your string from @extended?

Func blanktoplus($aa)
 $myString = StringReplace(GuiCtrlRead($aa), " ", "+")
 Return $myString
EndFunc

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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