Jump to content

Recommended Posts

Very good, thanks for sharing.

I have always thought I should do something with my two Dialog programs, to combine them as one, with added features to be fully featured.

Currently I have one program that creates a MsgBox, providing all the options for the standard AutoIt variations. It has a preview option of course, as well as an option to create a simple error dialog with one click. The other program is a viewer (and text editor), for when you may want to change or preview textual changes of a MsgBox. It will import the settings and export them, but currently doesn't provide a dynamic way to change anything other than typing (plus copy & paste) the text.

That said, maybe someone has already done that here .... I've not looked in a good long while, and no longer keep tabs on the Examples section like I once used to.


Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

This is really one of the best libraries in whole forum, I think.

 

There is just one mistake, in my opinion:
In line 464 of , I would await

...
                $vTmp = __advInputBox_objGet($aControls[$i], "selected", -1)    ; "selected" instead of "value"

 

Greetings from Germany

Patrick

Share this post


Link to post
Share on other sites

Hi and thanks :)

See documentation of combo field

{
  type:  "combo"
  id:    "name" (must be unique, without spaces)
  label: "label text"

  optionals:
  ----------
  options: ["option0", "option1" ...]
  value: 0|1|...|N OR "option0"|"option1"|...|"optionN"

  margin
  style, exstyle, color, bkcolor, font
  labelStyle, labelExStyle, labelColor, labelBkColor, labelFont
}

I named it "value" (not "selected"). This is to be consistent with other fields.

Same thing for list field.

Share this post


Link to post
Share on other sites

Yeaaaah, but.....
Using "value" (and the corresponding original line 464 in your code) seems to ADD e.g. the string "0" to the list and selects it.... 😐

Changing your code to "selected" seems to work as expected - at least for me!

Or do I use an old version of your library? I will check this...

 

Thanks for your quick response,

Patrick

 

Share this post


Link to post
Share on other sites

Changing your example 2 shows what I mean:

; All controls
Func Example2()
;    Local $sJSON = '{ title:"Showcase" font:[10, 600, 0, "Calibri"] controls:[' & _
    Local $sJSON = '{ title:"Showcase" controls:[' & _
        '{type:"label", text:"Enter you personal informations (please :p)"},' & _
        '{type:"input", id:"firstname", label:"First name"},' & _
        '{type:"input", id:"lastname", label:"Last name"},' & _
        '{type:"combo", id:"sex", label:"Sex", options:["Male", "Female"], value:0 selected:-1},' & _ ; selected = 0 for male, = 1 for female ; or you can use the exact same string as in options "Male" or "Female"
        '{type:"date", id:"dob", label:"Date of birth", value:"2020/01/01", style:0},' & _ ; $DTS_SHORTDATEFORMAT
        '{type:"separator"},' & _
        '{type:"edit", id:"address", label:"Address", lines:5},' & _
        '{type:"list", id:"options", label:"Options", options:["First", "Second", "Third"], selected:["First"]}' & _
        '{type:"label" text:"I agree to share my personnal informations with big brother:"}' & _
        '{type:"check", id:"agree", label:"Yes", value:true}' & _
    ']}'

    Local $oRet = advInputBox($sJSON)
    If @error Then
        MsgBox(64, "Example1", "Dialog canceled")
    Else
        MsgBox(64, "Example1", "Return: " & Json_Encode($oRet, 128))
    EndIf
EndFunc

I guessed "value" being an error because you used "selected" there, but it didn't work.

 

Greetings
Patrick

 

Share this post


Link to post
Share on other sites

it is possible that you use an old version. Always check the GitHub link to get the latest version.

I will check this now.

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

    • By v0id
      I am starting out using AutoIt. Here is a simple form with username and password. I want to check if information entered is valid once user clicks a button.
      My problem now is that it only validates once. E.g.: if I type 5 character username, it will complain it is not 7 character (good). But once I correct that mistake and press the button again it will still say the same thing.
      Do I need to have a loop?
       
      #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) $main = GUICreate("Test Tool", 600, 600) $hyourlabel = GUICtrlCreateLabel("YOUR CREDENTIALS", 30, 10, 256) GUICtrlSetFont($hyourlabel, Default, 600) Local $adminfrejalabel = GUICtrlCreateLabel("Username:", 8, 38, 64, 17) Global $adminfrejaid = GUICtrlCreateInput("", 80, 38, 110, 17) Local $adminpasswordlabel = GUICtrlCreateLabel("Password:", 8, 62, 64, 17) Global $adminpassword = GUICtrlCreateInput("", 80, 62, 110, 17, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) $userButton_Check = GUICtrlCreateButton("VALIDATE", 32, 480, 85, 25) GUICtrlSetOnEvent($userButton_Check, "startvalidation") GUISetOnEvent($GUI_EVENT_CLOSE, "ExitGUI") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func startvalidation() ;CHECK VALIDATIONS $adminfrejaid = GUICtrlRead($adminfrejaid) $adminpassword = GUICtrlRead($adminpassword) If StringLen($adminfrejaid) <> '7' Then MsgBox($MB_SYSTEMMODAL, "User ID", "Please enter exactly 7 characters.") ;Exit EndIf If StringLen($adminpassword) < '5' Then MsgBox($MB_SYSTEMMODAL, "Your Password", "Please enter a valid password.") ;Exit EndIf EndFunc Func ExitGui () Exit ; Exit the program EndFunc  
    • By robertocm
      I'm trying to use some inputboxes as radio buttons.
      This code seems to work ok, but don't know if there's is a better 'option'
      #include <GUIConstantsEx.au3> #include <GuiConstants.au3> GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Global $aInput[4] $hGUI = GUICreate("Test", 500, 500) $aInput[0] = GUICtrlCreateInput("Some text 1a", 10, 10, 200, 24) $aInput[1] = GUICtrlCreateInput("Some text 1b", 10, 40, 200, 24) $aInput[2] = GUICtrlCreateInput("Some text 2a", 10, 80, 200, 24) $aInput[3] = GUICtrlCreateInput("Some text 2b", 10, 110, 200, 24) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_COMMAND($hWnd, $msg, $wParam, $lParam) Local $nNotifyCode = BitShift($wParam, 16) ; high word Local $nID = BitAND($wParam, 0xFFFF) ; low word Local $hCtrl = $lParam Switch $nID Case $aInput[0] Switch $nNotifyCode Case $EN_SETFOCUS GUICtrlSetBkColor($aInput[0], 0x98FB98) GUICtrlSetBkColor($aInput[1], 0xD3D3D3) EndSwitch Case $aInput[1] Switch $nNotifyCode Case $EN_SETFOCUS GUICtrlSetBkColor($aInput[0], 0xD3D3D3) GUICtrlSetBkColor($aInput[1], 0x98FB98) EndSwitch Case $aInput[2] Switch $nNotifyCode Case $EN_SETFOCUS GUICtrlSetBkColor($aInput[2], 0x98FB98) GUICtrlSetBkColor($aInput[3], 0xD3D3D3) EndSwitch Case $aInput[3] Switch $nNotifyCode Case $EN_SETFOCUS GUICtrlSetBkColor($aInput[2], 0xD3D3D3) GUICtrlSetBkColor($aInput[3], 0x98FB98) EndSwitch EndSwitch ; Proceed the default Autoit3 internal message commands. ; You also can complete let the line out. ; !!! But only 'Return' (without any value) will not proceed ; the default Autoit3-message in the future !!! Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Would you recommend using _WinAPI_GetFocus instead?
       
       
      Thanks,
       
    • By Ackerz
      Hi guys,
      So I am trying to automate a task and this task has an input box with an already set character "9". 
      I have just decided that I don't really need the input as an option but it's good to leave however for this instance I would like it to run past this point automatically. I've tried numerous ways to try and automate the use of the "OK" button using ControlClick and various other options. I just can't seem to see where this point in the script is. Scoured the forums for anything similar but didn't have any luck finding anything. Sorry to be a pain and I hope someone can help, if I haven't explained in enough detail please don't hesitate to ask for more.
      Many thanks,
      Ackerz
       
      Local $len Local $n Local $buff Local $aMyDate $Len = InputBox("Test",$msgPrompt,"9") $len = StringStripWS($len,$STR_STRIPALL) ;Check that user has entered a vaild password length if not StringIsDigit($len) or $len = 0 Then MsgBox(48,"Error","Invaild Integer was entered" & @CRLF & "Program will now exit.") Exit EndIf ;This creates the random password. for $i = 1 to $Len ;Pick a random char between 1 and the pwsMask Length $n = int(random(1,StringLen($pwsMask))) ;Concat each char that has been picked out of pwsMask to $buff $buff = $Buff & StringMid($pwsmask,$n,1) Next  
    • By ramin92003
      Hi, 
      Is there any possibility to change the cancel button text to quit in the Inputbox?
    • By pixelsearch
      Hi everybody,
      I wanted to share with you this short piece of code where InputBox will always be on top (it's important to have it on top, kind of "MsgBox style") .  It's the shortest way I found to make it happen, with few lines of code :
      Do $sNb_Quest = InputBox("Quiz", "How many questions to answer ? (1-99)", "10", " M2", _ 220, 140, Default, Default, 0, GUICreate("", 0, 0, 0, 0, Default, @SW_SHOWDEFAULT)) If @error = 1 Then MsgBox(4096, "End of script", "You choosed to Quit") Exit EndIf GUIDelete() ; place this line here, not just after InputBox, or @error will be reset to 0 $iNb_Quest = Number($sNb_Quest) Until $iNb_Quest > 0 And IsInt($iNb_Quest) = 1 MsgBox(4096, "Result", "Your choice : " & $iNb_Quest) In the precedent code, the user can't type more than 2 characters. Inputs like "0" or ".5" or "-1" will be automatically rejected, also the Input is mandatory, default is 10. The last parameter, GUICreate, is the key to have this InputBox always on top (in a quick way)

      My question is : should GUIDelete() be present in the code or can we delete that line ?
      It seems to work fine without the GUIDelete() line, but in case the loop repeats several times (because of bad inputs), then we will have several GUICreate() without a single GUIDelete() ?
      Thanks for... your input 
       
×
×
  • Create New...