Giter Club home page Giter Club logo

Comments (6)

fresh2dev avatar fresh2dev commented on September 25, 2024

Thank you for bringing these issues to my attention. Some of these issues are the result of typos in the documentation, while others are bugs. I went through each of the issue you presented in the code below:

# Show-AnyBox -Message 'Provide your name:' -Prompt @{} -Comment 'First name only' -Buttons 'OK'
#-- error "Item has already been added. Key in dictionary: 'txt_Explain' Key being added: 'txt_Explain'"
#-- removing comment removes error
# bug fixed by removing duplicate creation of txt_Explain (pending upload)

# Show-AnyBox -Title 'AnyBox Demo' -Message 'Select a number:' -Buttons @(1..9) -ButtonRows 3
#--comes back with name value pair 1-9
#--The number that is selected is in the list twice - is that desired result
# *** bug fixed by casting all button keys to string: (pending upload). Workaround like so:
$ans = Show-AnyBox -Title 'AnyBox Demo' -Message 'Select a number:' -Buttons (@(1..9) -as [string[]]) -ButtonRows 3
#--If so how would you recommend testing to figure out what buttons was pressed?
$btn_pressed = $ans.GetEnumerator() | where Value -eq $true | select -ExpandProperty Name



# $prompt = New-AnyBoxPrompt -Name 'test' -Message 'Enter any number between 0 and 100:' -ValidateScript { $_ -ge 0 -and $_ -le 100 }
# Show-AnyBox -Prompt $prompt -Buttons 'Submit'
#--even if I type 9 in I never get out of loop
# *** need to correct typos in documentation; use:
$prompt = New-AnyBoxPrompt -Message 'Enter any number between 0 and 100:' -ValidateScript { [int]$_ -ge 0 -and [int]$_ -le 100}
Show-AnyBox -Prompt $prompt -Buttons 'Submit'

#Show-AnyBox -MinWidth 350 -Buttons 'Cancel', 'Submit' -Prompt @(
#(New-AnyBoxPrompt -InputType 'FileOpen' -Message 'Open File:', ReadOnly=$true),
#(New-AnyBoxPrompt -InputType 'FileSave' -Message 'Save File:', ReadOnly=$true)
#)
#--could not get this to work at all
# *** need to correct typos in documentation; use:
Show-AnyBox -MinWidth 350 -Buttons 'Cancel', 'Submit' -Prompt @(
  (New-AnyBoxPrompt -InputType 'FileOpen' -Message 'Open File:' -ReadOnly),
  (New-AnyBoxPrompt -InputType 'FileSave' -Message 'Save File:' -ReadOnly)
)

#Show-AnyBox -Icon 'Question' -Buttons 'Cancel', 'Ignore' -Message 'An error occurred. (Code=123)'
#-Prompt (New-AnyBoxPrompt -InputType 'Checkbox' -Message "Don't ask again." -DefaultValue=$true)
#-- had to remove defaultvalue=$true
# *** need to correct types in documentation; use:
Show-AnyBox -Icon 'Question' -Buttons 'Cancel', 'Ignore' -Message 'An error occurred. (Code=123)' `
    -Prompts (New-AnyBoxPrompt -InputType 'Checkbox' -Message "Don't ask again." -DefaultValue $true)

# Show-AnyBox -Buttons 'OK' -MinWidth 200 -Prompt @(
# (New-AnyBoxPrompt -InputType 'Link' -Message = 'My Files' -DefaultValue $env:USERPROFILE),
# (New-AnyBoxPrompt -InputType 'Link' -Message = 'Reddit' -DefaultValue 'www.reddit.com' -ValidateNotEmpty),
# (New-AnyBoxPrompt -InputType 'Link' -Message = 'Notepad' -DefaultValue 'notepad.exe')
# )
# got error - WARNING: Name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores.
# The link showed as Equal signs with underlines.
# *** need to correct types in documentation; use:
Show-AnyBox -Buttons 'OK' -MinWidth 200 -Prompt @(
    (New-AnyBoxPrompt -InputType 'Link' -Message 'My Files' -DefaultValue $env:USERPROFILE),
    (New-AnyBoxPrompt -InputType 'Link' -Message 'Reddit' -DefaultValue 'www.reddit.com' -ValidateNotEmpty),
    (New-AnyBoxPrompt -InputType 'Link' -Message 'Notepad' -DefaultValue 'notepad.exe')
)

I will keep this issue open until I upload the latest revision.

Also, I will look into the possibility of implementing double-click support for the data grid.

Thank you for the suggestion and the review.

  • Donald

from anybox.

g-pearl avatar g-pearl commented on September 25, 2024

I have tried all the commands and still have an issue with the following:

Show-AnyBox -Icon 'Question' -Buttons 'Cancel', 'Ignore' -Message 'An error occurred. (Code=123)' `
-Prompts (New-AnyBoxPrompt -InputType 'Checkbox' -Message "Don't ask again." -DefaultValue $true)

The dialog box comes up but I get the red text:
Unable to find type [System.Drawing.SystemIcons].

I have tried on work desktop as well as personal laptop. If I copy and paste "[System.Drawing.SystemIcons]" into a powershell window it works so I believe I have the proper "files" on the machine

Thanks for you response

from anybox.

fresh2dev avatar fresh2dev commented on September 25, 2024

I just published v0.3.1 to the Powershell Gallery. Please install the latest version and let me know if any of your original issues persist.

Thank you,
Donald

from anybox.

g-pearl avatar g-pearl commented on September 25, 2024

I have updated the module and things appear to be working.

When following the examples on (https://www.donaldmellenbruch.com/post/introducing-the-anybox/)

When I try the example:
Show-AnyBox -Message 'Enter anything:' -Prompt (New-AnyBoxPrompt -ValidateNotEmpty)
-Buttons 'Cancel', 'Submit' -CancelButton 'Cancel' -DefaultButton 'Submit'
-- No Buttons Show up.

All other commands are working. Thanks for the updates.

from anybox.

fresh2dev avatar fresh2dev commented on September 25, 2024

Ah, that's an easy one to fix. My example is apparently missing the line-continuation character, `.

You can enter it all on one line, or add the line-continuation character yourself.

Thanks for the help in identifying the bugs and typos!

from anybox.

g-pearl avatar g-pearl commented on September 25, 2024

Yes that fixed it. Please feel free to use me in the future as a test subject if you like.

Thanks again this is helping make some of the script that I am working on be more user friendly.

from anybox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.