Jump to content

Need some help here


Recommended Posts

I'm trying something...

create an input to get number of combo required

$RSVpc = GUICtrlCreateInput("1", 500, 45, 60, 20) ;Number of VIEW PC

autoIT will base on user input then create number of combo required.

$x3 = 45

For $FLoop3 = 1 To GUICtrlRead($RSVpc)

$x3 = $x3 + 25 ;for combo location purpose

GUICtrlCreateInput("VIEW0804", 500, $x3, 60, 20)

Next

But seem like my script doesn't get the update input from user.

Currently the number of combo that created is based on $RSVpc default value which is 1.

Anyone can give me some ideal how to create a script that number of combo creates will base on user input

Edited by yclee99
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

GUICreate("Dynamic CtrlCount", 250, 500)

$InputCount = GUICtrlCreateInput("", 15, 15, 50, 20)
$btnUpdate = GUICtrlCreateButton("Create", 115, 15, 50, 20)

GUISetState()





While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnUpdate
            _CreateButtons()
    EndSwitch
WEnd


Func _CreateButtons()
    $CtrlCount = Int(GUICtrlRead($InputCount))
    
    If $CtrlCount > 0 Then
        $top = 50
        For $i = 0 To $CtrlCount
            GUICtrlCreateButton("Button " & $i, 15, $top, 75, 20)
            $top += 25
        Next
    GUICtrlSetState($btnUpdate,$GUI_DISABLE)
    EndIf
    
EndFunc   ;==>_CreateButtons

Try this , it will create controls for you.

Link to comment
Share on other sites

This quick and dirty code does what you typed and it works.. So is this not what you'd like?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$gui = GUICreate("1", 500, 700)
$RSVpc = GUICtrlCreateInput("1", 10, 10, 60, 20) ;Number of VIEW PC
$btn = GUICtrlCreateButton("go", 10, 40, 100, 20)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If $msg = $btn Then create()
WEnd

Exit

Func create()
    $x3 = 85
    For $FLoop3 = 1 To GUICtrlRead($RSVpc)
        $x3 = $x3 + 25 ;for combo location purpose
        GUICtrlCreateInput("VIEW0804", 10, $x3, 60, 20)
    Next
EndFunc

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

GUICreate("Dynamic CtrlCount", 250, 500)

$InputCount = GUICtrlCreateInput("", 15, 15, 50, 20)
$btnUpdate = GUICtrlCreateButton("Create", 115, 15, 50, 20)

GUISetState()





While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $btnUpdate
            _CreateButtons()
    EndSwitch
WEnd


Func _CreateButtons()
    $CtrlCount = Int(GUICtrlRead($InputCount))
    
    If $CtrlCount > 0 Then
        $top = 50
        For $i = 0 To $CtrlCount
            GUICtrlCreateButton("Button " & $i, 15, $top, 75, 20)
            $top += 25
        Next
    GUICtrlSetState($btnUpdate,$GUI_DISABLE)
    EndIf
    
EndFunc   ;==>_CreateButtons
Thanks a lot guys.

This is the 'function' that I want.

I will try to applied in my main script.

Link to comment
Share on other sites

No, only if the button is highlighted or selected whatever to call it.

Both scripts say that the button has to be pressed accourding to this code:

Case $btnUpdate
            _CreateButtons()oÝ÷ Ø    Ýjëh×6If $msg = $btn Then create()oÝ÷ Ù.r¥uú+{¦¦W¬zÖ¡¢ÙÊØZ·^§®Ö¢G²ÊkzËvØ^~éܶ*'~*Þ°LZ^¶­Ê¢é]¥«-y·¢·­å¡Wµ
ê^اìr¸©·*.j·®²)àjëh×6HotKeySet(Chr(13), "_CreateButtons")oÝ÷ ØêÚºÚ"µÍÝÙ^TÙ]
ÚLÊK  ][ÝØÜX]I][ÝÊ

Note: Chr(13) is the equivelant of the enter-key

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Link to comment
Share on other sites

Note: You should copy this in the fired funtion to disable the hotkey:

HotKeySet(Chr(13))

Also note:

Both script don't delete the existing controle, so dont run the funtion twice per script-run. (Ok, the first script does disable the run-function button, and I don't :))

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Link to comment
Share on other sites

Note: You should copy this in the fired funtion to disable the hotkey:

HotKeySet(Chr(13))

Also note:

Both script don't delete the existing controle, so dont run the funtion twice per script-run. (Ok, the first script does disable the run-function button, and I don't :))

Thanks dude...

After applied the script to my main script, I am facing another 2 issues. I will tried to solve first before seek for help....

p/s:basically your scirpt doesn't have any problem...

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