am using C#, VS-2005
am generate runtime controls like textBox and works it fine but the Indexing problems on it. my code below as follows.
//tbpoint Declare in GlobalArea.
int i=0;
TextBox tb= new TextBox();
tb.Location=tbpoint;
tb.Size=new size(970,60);
tb.Name="Tbox"+i.tostring();
tb.Keypress+=new KeypressEventHandler(tbb_Keypress);
tbpoint+=70;
i++;
this.panel1.Controls.Add(tb);
Above Code call in EnterKeypress Event and works fine but the problem is of Indexing the textboxes generated. The index not increment by 1.
How can I Solve It. Please Help Me.
The must declare the variable i also in the class body (which you call "global area"). Otherwise, i is reset on every method call to zero.
If by Index you mean Tab Index, you will need to set that yourself for dynamic controls.
System.Windows.Forms.Control.TabIndex
Related
I am working on a MQL4 expert advisor. This advisor uses 2 separate
timeframes for its signals and entries/exits. Up until now I have used an "sinput" to allow the user to choose the desired timeframe for the higher timeframe indicators.
I would like to remove the option, and have the optimized pairs set automatically in my code. I am attempting to initiate a variable "IndicatorTF", and then later assign it a value of the desired timeframe.
Every other portion of my code runs just fine, however programmatically setting and changing timeframes is new to me.
If I try to initialize the variable "IndicatorHTF" globally and then actually set the value in "On Init" I get an error stating that I cannot change a constant. If, however, I set the "IndicatorHTF" variable directly in "On Init", just before it is actually used, I get a declaration error as I cant seem to find the correct type.
I realize its not a bool, int, double, or string, but I have no Idea what I should be using as a type.
What ive tried:
1)
//Globally
ENUM_TIMEFRAMES IndicatorHTF; //with sinput,bool,string,etc
int OnInit()
{
if(Period()==PERIOD_M1){resolution=PERIOD_M5;}
}
2)
int OnInit()
{
ENUM_TIMEFRAMES IndicatorHTF; //with sinput,bool,string,etc
if(Period()==PERIOD_M1){resolution=PERIOD_M5;}
}
Fixed the issue, it was simply a placement issue. By setting
if(Period()==PERIOD_M1){IndicatorHTF=PERIOD_M5;}
actually within my trade logic that used IndicatorHTF it was able to read and set the values correctly :)
We all know and love the autocomplete feature of Xcode.
The above screenshot is taken from Xcode 9. I looks identical to what it did in Xcode 8. It knows about my class, and all of its different declarations and functions etc. This is not a SearchPaths-problem.
In Xcode 8, we were able to start typing the function name or the name of any variable used in the declaration of any function/initialiser to help the autocomplete single out which we want, like this:
However, in Xcode 9 this no longer happens. Instead, it completely ignores context and starts to show autocompletion as if I was typing this on a new line.
Is there a way to enable this again? I didn't know I needed this function until I lost it.
This happens to me in XCode 9.3, but only (it seems) if all the following conditions are met:
The instance is created from a different file or scope than the type definition
The instance is not created from within a function
An instance of the same type has not already been created at the current scope. (As discussed here.)
This implies some possible workarounds. You can create the instance within a function and then move the line of code elsewhere. Or you can create a dummy instance first, followed by the real instance on the next line—this works even if you don't include the arguments on the dummy line. For example:
let dummy = MyObject // no autocomplete available here
let obj = MyObject(anything: Any Object) // autocomplete working on this line!
Think of the following:
I've got a table data grid webcomponent and another component providing a data feed. In the applications main acting as kind of controller, i'd like to wire and setup those two components. Therefore i need a reference to underlying table grid instance Dart class and call methods on the "Component API' (to provide the table grid's tablemodel with data).
How do I access the Dart Class instance of a webcomponent instance from outside ?
Probably I missed something fundamental or are polymer webcomponents meant to interact only using databinding and stringy attributes stuff ?
Follow up: Found it !!
RLTable table = querySelector("#apptable").xtag;
does the job
As zoechi pointed out, xtag is not necessary.
var component = $['myComp'];
var componentXtag = $['myComp'].xtag;
print(component == componentXtag);
prints true. Therefore both
component.method()
componentXtag.method()
work fine
You don't need xtag. Some weeks/months ago this was a workaround until the final solution was landed.
I have a JavaFX GUI in an fxml file with its controller class defined. I have two text items that I want in that GUI, one tied to a variable whose value does not change until the user reloads the screen, the other I would think needs to be a StringProperty as it shows the running total of a column in my TableView. Because of what they are, I'm trying to use Label instead of a TextField as their display control.
I liked Sebastian's answer to this problem here:
Displaying changing values in JavaFx Label
however, when I try to use it I get a compile error that says:
cannot find symbol
symbol: variable textProperty
location: variable salesNoLabel of type Label
I'm not sure what I'm doing wrong, but to start with, my label text is initially set in the fxml file, so in my controller I just have its fx:id substituted for "myLabel" listed in Sebastian's answer:
salesNoLabel.textProperty.bind(sn);
where salesNoLabel is the fx:id of the label and sn is a string variable.
Not sure if you need to see more of my code to help me with this problem, but thanks in advance for checking it out.
Sebastian's answer had a syntax error, I edited it to fix it.
You need to invoke the textProperty() method on the label:
salesNoLabel.textProperty().bind(sn);
Note the addition of parentheses after the textProperty identifier to invoke the method.
I would like to do coloring in Eclipse without using the presentation reconciler. Therefore, first, I need to figure out how to associate a TextPresentation object with either my editor or document, but I am having difficulty finding out how to link it either of those. Normally, the CreatePresentation in the IPResentationReconciler interface would give the style range to the textpresentation, and from there Eclipse would know what to do with that presentation object. Is there some way to use a TextPresentation object without the use of PresentationReconciler? It would be nice if I could do coloring without the use of reconciler. Thank you.
I finally figured out how to achieve the coloring without the use of Reconcilers.
I discovered that first I needed a way to obtain a reference to my SourceViewer object, as I am extending TextEditor. I also discovered that I could implement the TextListener interface and add my own listener to the SourceViewer object. One must be careful, however, as calling the getSourceViewer() method can result in null if not called at the appropriate spot. Originally, I overwrote the init(...) function in my editor class and made the getSourceViewer() call, but it still resulted in null. After doing a bit of research, I discovered that I could properly obtain a reference to the SourceViewer object by overriding the createPartControl method. I first call super.createPartControl(...) and then make a call to getSourceViewer(). After I obtained that reference, I used that with my listener class I created and was able to do the coloring myself with the setTextColor method the SourceViewer object has. Hope this helps others in the same situation.