Jump to content

How can I do ?


Maurizio
 Share

Recommended Posts

Hi

The best way to enter a predefined set of numbers is to use a Read-only combo box, and to add the needed numbers.

If you need it in an input box, then you can use something like this:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 283, 45, 192, 124)
$hinp = GUICtrlCreateInput("", 13, 11, 248, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$htimer = TimerInit()

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

    If TimerDiff($htimer) > 1500 Then
        $input = GUICtrlRead($hinp)
        if Not(IsNumber($input)) then GUICtrlSetData($hinp,1)
        If $input < 1 Or $input > 10 Then           
            GUICtrlSetData($hinp, (Mod($input, 9)+1))
        EndIf
        $htimer = TimerInit()
    EndIf
WEnd

 

Edited by Dan_555
Small corrections

Some of my script sourcecode

Link to comment
Share on other sites

Immagine.jpg.04a5044a9fd7636be586e26998043b6b.jpgA number from 1 to 10 is typed in the third box. This number will activate an action of the program with 10 different variables, so if I write 3, the number 3 will have to be chosen from the ten options.
I hope I was clear, I was getting confused while writing :)

Link to comment
Share on other sites

  • Developers

Don't you think that you simply just need to be patient till somebody is willing to help you?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

I knew that already, but my comments are not about the chosen words but rather you are bumping you thread in the hope you get faster help, which is considered impolite and against out forum etiquettes.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

This is a good use case for a combobox, leaving only a limited number of choices. Also you can give options 1, 2, 3, ..., 10 more explicit "names" (plain text).

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

It may be but I don't understand how it works and therefore I can't implement it in my little program. I need that typing a number in the input box, the program goes to read that number, and use the corresponding variable, so if I write 3 it chooses the variable 3, without writing any message.
Thanks for your patience and availability.

Link to comment
Share on other sites

Here is an example with Combo box;

#include <GUIConstants.au3>

GUICreate('', 120, 40)
GUICtrlCreateCombo('', 10, 10, 100, 200, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL))

For $i = 1 To 10                ;Enter the predefined numbers into the combo box
    GUICtrlSetData(-1,$i)
Next
GUICtrlSetData(-1, '1')         ;Set the 1st entry to 1

GUISetState()

While 1
    If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd

 

Some of my script sourcecode

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