From: Guido Tripaldi on 26 Feb 2010 04:04 Thank you Adam! Problem solved! I would like to propose two improvements in the Documentation Center: the first is to add the possibility to add custom comments in the functions/commands help pages (where to store, for example, the suggestions, like this, found in the user group, some personal sample code, etc). The second, similar but different, is to add a section in the help pages with a view to a sort of wiki where every mathgroup users can add samples, comments and explanations tagged for relevants functions/commands. This would make it possible to always have readily available the maximum information for each command. Cheers, G Il giorno 25/feb/2010, alle ore 17.19, Adam Griffith ha scritto: > ChoiceDialog[] blocks the kernel evaluation until it is closed. Therefore you could do something like: > > TabView[{"Tab1" -> Button["Show ChoiceDialog", result = ChoiceDialog["This holds eval.. :-)."], Method -> "Queued"], "Tab2" -> Button["Show MessageDialog", MessageDialog["This works!"];]}] > > -Adam > > > > > > Guido Tripaldi wrote: >> Hi Group, >> suppose you wanna to display an alert to the user before to continue the execution of your code when some conditions occur : probably you'll use ChoiceDialog[], the useful function that "puts up a standard choice dialog that displays expr together with OK and Cancel buttons, and returns True if OK is clicked, and False if Cancel is clicked.". >> >> But if you use this function inside some Dynamic[] object, it hangs the kernel. I've tried to find in the documentation some references to this bad combination without any luck, so I don't understand if this is a bug or there is something missing in the code. >> >> To better explain the problem here is a very basic example: >> >> (* just a silly example *) >> Grid[{ >> {"Choose a dividend: ", >> PopupMenu[Dynamic[dividend], Table[i, {i, 0, 10}]]}, >> {"Choose a divisor : ", PopupMenu[Dynamic[divisor], Table[i, {i, 0, 10}]]}, >> {"Quotient: ", Dynamic[dividend / divisor]} >> }, Frame -> All] >> Dynamic[ >> If[divisor == 0, >> ChoiceDialog["Uh-oh, you are going to do a division by zero! Please select a different divisor.", {"Ok"}]; >> ]]; >> >> Instead, if you use the MessageDialog[] function to show a message window, all works well, but of course the execution will continue without waiting for the user action (that is not what I want). >> >> Same situation if you try to use ChoiceDialog[] inside a TabView, or other kind of Views: >> >> (* another silly example *) >> TabView[{ >> "Tab1" -> Button["Show ChoiceDialog", result = ChoiceDialog["This hangs.. :-(."];], >> "Tab2" -> Button["Show MessageDialog", MessageDialog["This works!"];] >> }] >> >> >> Any suggestion? >> thanks! >> G >> >> ps >> M7.0.1.0 on Mac Snow 10.6.2 >> >> --- >> Guido Tripaldi >> >> >> > --- Guido Tripaldi imho.gtripaldi.it
|
Pages: 1 Prev: Programmatically saving myself Next: ListLinePlot with null value |