I have been using Scratch for a few months, but am suddenly completely and inexplicably stuck.
I can't get a simple if-then condition to trigger.
After stripping down to the bare essentials, I have this:
the variable d successfully changes when I press space, but never triggers the if-then, even when d=5, as confirmed by the display.
What am I missing?
You need to add the variable to the expression, like this (Notice the orange color of d, drag it from the section "Variables"):
Related
I have a problem which looks like some kind of a bug. Sometimes it happens that a Checkbutton first appears checked when created and it seems like there is no apparent reason for this behaviour. I'm using external variables to get information about status of the checkbox and I'm sure I reset them right before the declaration. My declaration looks like this:
#item is a string
cbtn = Checkbutton(master, command=lambda method=item: fun(method))
You can see there's even no variable or state argument in the declaration, so I think this should always create an empty checkbox. Yet somehow, sometimes it appears checked at first, which is a problem because I'm creating a lock and then it looks opposite than it's supposed to.
So, is there a sureproof way to make it appear without a checkmark?
So, is there a sureproof way to make it appear without a checkmark?
Yes. Explicitly set the onvalue and offvalue attributes, associate a variable with the checkbutton, and explicitly set the value of the variable to the same as the offvalue.
I have a form here with a nested table - where each table can dynamically grow, i.e., the inner table (w/ Transit No and Account No) and the outer table (Accounts by ID No). Here is an example:
(Behind the buttons:
Add - $.parent.tbl.Row.instanceManager.addInstance();
Remove - $.parent.instanceManager.removeInstance(this.parent.index); (In
production I make sure there is at least one row to remove...)
In the definition for each table I do not have checked 'Repeat Table for Each Data Item'. This works great. However I did try with that checked and the outcome was the same.
Now, when I email the form and open the attachment, this is what I see:
You can see that the second table didn't make it, and apparently a row was added to the inner table in the first, without any data.
Any ideas on what's going wrong here? And what I can do about it?
Unfortunately I'm not sure what's wrong with your form but I have made a similar form that works - so I can show you how I did it and list a few things that I can think of that can cause problems.
This is what my form looks like and when I e-mail it, it comes out exactly the way it is:
(It has repeatable parent- and childsubforms like yours)
I did it entirely with JS though, no FormCalc and Dollar $igns :D
When a button is pressed I call a function from a Scriptobject.
These are the main parts of my script inside my functions:
Adding a Subform:
var oNewInstance = subform.instanceManager.addInstance(1);
Deleting a Subform:
if (subform.instanceManager.count > subform.instanceManager.occur.min)
{
subform.instanceManager.removeInstance(subform.index);
}
And these are my subforms' properties (in German, but you can figure it out :P):
Your problem might also have completely other reasons though, make sure you don't have any changes in an initialize,docReady, preSubmit and similar actions that occur between sending and opening the sent PDF.
Also before sending it as an e-mail you have to save it in Acrobat as a Reader Extended PDF:
Besides that I've noticed that sometimes problems can occur due to the target version (Selectable in LCD under File > Form Properties > Defaults).
It helped me sometimes to set it to the newest one.
What I want from VS2015's autocomplete when coding C++ is that when I start typing the name of a variable, it automatically suggests that variable and when I press space, it commits it (which is the default behavior for C#).
I first had to find out how to make sure the suggestion was actually selected, which I found here: https://stackoverflow.com/a/20342224/2471262.
Sadly, this doesn't fully do what I want it to. When pressing enter, it now automatically commits the variable name. However, this doesn't work for space. When first pressing ctrl+space and then typing part of the variable name, space bar actually works to commit the variable name. So basically this is the result:
Suppose we have a var named abcd.
<ctrl+space>ab<enter> => abcd // First two works without changing Member
<ctrl+space>ab<space> => abcd // List Commit Aggressive from False to True
ab<enter> => abcd // Works with Member List Commit Aggressive set to True
ab<space> => ab // This somehow does not work :(
Does anyone know a solution to get the final option to work? Or is this just a bug in VS? It's really annoying not to have it working, since I'm used to it from C#.
How do you get the state of a Button (clicked or unclicked)? This is a button state and not a question about variables set by the button. How do I tell if an object in a Frame is selected using i.winfo_class() to identify a Radiobutton.
i.e.
for i in a.winfo_children():
if i.winfo_class() == "Radiobutton":
i.get()
Radiobuttons have no get attribute so this will never work, but the logic is the same. I've looked through documentation without success.
The only solution is to get the value of the associated variable and compare it to the value of the radiobutton. If they are the same, that radiobutton is selected.
Found the solution. ttk.Radiobutton has more functionality than the tkinter.Radiobutton.
Please make note there there are major issues with all methods and values dereferences by Radiobuttons even now. Sometimes you get a pointer, sometimes you get a string and need to dereference yourself. This makes Radiobuttons a more difficult Widget to deal with than most of the others I've been working with. There are many documents on this and they are fixing this, but it is something to note.
For my purposes, tkinter.Radiobutton has no instate which means there is no simple way to check if it is clicked. I was getting pointer after pointer and dereferencing was far too tedious and complex to code for a dynamic gui.
The code I've ended up with is as follows:
for i in a.winfo_children():
if i.winfo_class() == "TRadiobutton" and i.instate(['selected']) is True:
return i.cget('value')
Also make note that TRadioButton string is used instead of RadioButton, the object type returned is not the same between ttk and tkinter implementations of Radiobutton.
In mutt, I'd like to keep track of important messages which I need to answer, pretty much like I did in GMail before. The problem is that I tend to forget that I have such important messages, and so, never run the macro which makes flagged messages appear (in case they are too old to appear in the index). So, I'd like that the flagged messages always appear in the main index, no matter how old they are. This setting, along with the fact that the flagged messages appear in a different color (they already do), should be enough to prevent me to forgetting answering old - but important - messages. Is that possible ?
Thanks in advance!
The ordering of messages cannot be changed arbitrarily outside the scope of sort and sort_aux. However, you can limit the messages in your index to specific kinds of mail and bind everything neatly to macros, like so:
macro index .i "<limit>(~N|~F)<Enter>" "view new/flag"
macro index .a "<limit>~A<Enter>" "view all"
The first macro .i will limit messages in the index to only flagged (starred) and new ones, whereas the latter .a will remove any limit and show all messages, again.
You can automatically apply one of these views when entering a mail folder by utilizing a folder-hook.
folder-hook */INBOX push .i
Just alter the regular expression following the hook to whatever folder(s) you want to apply the macro to. Simply press .a at any point in the index to show all messages, again.
For further details consult the manpage, as it is fairly comprehensive.
That's a great hint and it works, I only had to change folder-hook to point to /var/mail/username (Linux INBOX).
I only wonder if the "push" (or maybe even the macro itself) could be made conditional, that is to work only if there are any new/flagged messages. As it is now, if there are no such messages, one gets empty list and has to manually execute ".a" macro.