Search Results

Search found 5349 results on 214 pages for 'override'.

Page 1/214 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to implement an override method in IronPython

    - by Adal
    I'm trying to implement a WPF control in IronPython and I'm having trouble implemented the override methods. The code below fails with this error: TypeError: expected int, got instancemethod. If I rename the VisualChildrenCount method, the exception is not raised anymore, but the control doesn't work. So how do I tell IronPython that the method is an override? class PaintCanvas(FrameworkElement): def __init__(self): self.__children = VisualCollection(self) dv = DrawingVisual() self.__children.Add(dv) # In C# this should be: protected override int VisualChildrenCount def VisualChildrenCount(self): return self.__children.Count # In C# this should be: protected override Visual GetVisualChild(int index) def GetVisualChild(self, index): return self.__children[index]

    Read the article

  • Android @Override usage

    - by BahaiResearch.com
    (Newbie to Java, old time C# guy.) I have noticed a lot of the use of @Override in Android example code. I thought that all Java methods were by default "Virutal"? What then does @Override do? Example: private class HelloWebViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }

    Read the article

  • iReport / jFreeChart - Combining getItemPaint() override and series colors

    - by barneskd
    I'm attempting to create a bar chart that needs to use specific series colors for N number of categories and a separate color for 1 other category. Here is an example: http://i.imgur.com/1DeCF.png (Sorry, I don't have enough points to embed images yet) In the mockup, Categories 1-3 use a collection of 5 colors to render their series while Category 4 uses a single grey color. My first approach was to override the getItemPaint() method using a customizer class, but I can only figure out how to define a color on the category level, not the series level. Is it possible to define colors on category and/or series levels? Something like, If category != "Category4" Use colors A, B, C, D, and E in category's series Else Use color F in category's series Another thought I had was to combine iReport's Series Colors bar chart property and the getItemPaint() override; that way I could define the 5 colors to use in iReport and use the getItemPaint() override only in the case where the category equals "Category 4". So far I've had no luck combining the two; if the override is defined it overrides iReport's Series Color property.

    Read the article

  • can not override showDialog in Activity tab

    - by hornetbzz
    Trying to downgrade my appl from android 2.2 (API 8) down to android 2.1 (API7), I'm facing some issues with dialog boxes. Based on this thread, I'm trying to catch these exceptions but can't override the showDialog method. I turned the Java compiler from 1.5 to 1.6 according to this answer to a similar issue, but no changes, Eclipse still returns : Cannot override the final method from Activity public class MyActivity extends Activity implements SeekBar.OnSeekBarChangeListener { // ... some stuffs @Override // here is the issue public void showDialog(int dialogId) { try { super.showDialog(dialogId); } catch (IllegalArgumentException e) { Log.e(ACTIVITY_TAG, "Error dialog"); } } @Override protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_ALERT: // Create out AlertDialog Builder builder = new AlertDialog.Builder(this); builder.setMessage(msg); builder.setCancelable(false); builder.setPositiveButton(GOTO_BOOK, new OkOnClickListener()); builder.setNegativeButton(STAY_HERE, new CancelOnClickListener()); AlertDialog dialog = builder.create(); dialog.show(); break; case DIALOG_ONCREATE: // Create out AlertDialog during the "onCreate" method (only "Ok" // button) Builder builder2 = new AlertDialog.Builder(getParent()); builder2.setMessage(msg); builder2.setCancelable(false); builder2.setPositiveButton(GO_BACK, new OkOnClickListener()); AlertDialog dialog2 = builder2.create(); dialog2.show(); break; } return super.onCreateDialog(id); } // ... some stuffs }

    Read the article

  • Confused about "override" vs. "new" in C#

    - by iTayb
    I'm having the following classes: class Base { public virtual void Print() { Console.WriteLine("Base"); } } class Der1 : Base { public new virtual void Print() { Console.WriteLine("Der1"); } } class Der2 : Der1 { public override void Print() { Console.WriteLine("Der2"); } } This is my main method: Base b = new Der2(); Der1 d1 = new Der2(); Der2 d2 = new Der2(); b.Print(); d1.Print(); d2.Print(); The output is Base, Der2, Der2. As far as I know, Override won't let previous method to run, even if the pointer is pointing to them. So the first line should output Der2 as well. However Base came out. How is it possible? How the override didn't work there?

    Read the article

  • How can I override TryParse?

    - by cyclotis04
    I would like to override bool's TryParse method to accept "yes" and "no." I know the method I want to use (below) but I don't know how to override bool's method. ... bool TryParse(string value, out bool result) { if (value == "yes") { result = true; return true; } else if (value == "no") { result = false; return true; } else { return bool.TryParse(value, result); } }

    Read the article

  • Override delete behaviour in NHibernate

    - by David
    Hi all In my application users cannot truly delete records. Rather, the record's Deleted field gets set to 1, which hides it from selects. I need to maintain this behaviour and I'm looking into whether NHibernate is appropriate for my app. Can I override NHibnernate's delete behaviour so that instead of issuing DELETE statements, it issues UPDATES, as described above? I would obviously also need to override its SELECT behaviour to include the 'AND Deleted = 0' clause. Or read from a view instead. I dunno. TIA for your advice. David

    Read the article

  • Calling a method from within a django model save() override

    - by Jonathan
    I'm overriding a django model save() method. Within the override I'm calling another method of the same class and instance which calculates one of the instance's fields based on other fields of the same instance. class MyClass(models.Model): field1 = models.FloatField() field2 = models.FloatField() field3 = models.FloatField() def calculateField1(self) self.field1 = self.field2 + self.field3 def save(self, *args, **kwargs): self.calculateField1() super(MyClass, self).save(*args, **kwargs) The override method is called when I change the model in admin. Alas I've discovered that within calculateField1() field2 and field3 have the values of the instance from before I edited them in admin. If I enter the instance again in admin and save again, only then field1 receives the correct value as field2 and field3 are already updated. Is this the correct behavior on django's side? If yes, then how can I use the new values within calculateField1? I cannot implement the calculation within the save() as calculateField1() actually quite long and I need it to be called from elsewhere.

    Read the article

  • Override bits of a CSS class while inline?

    - by larryq
    I have an html img that is being styled by a CSS class. I would like to override the width and height values used in that class under some circumstances. I'm building this img tag using something called a TagBuilder class, provided by Microsoft for the .Net system, which allows developers to assign attributes to an html element. In this case a CSS class has been assigned to the img tag, and I can assign width and height attributes individually, but they're not taking precedence over the values set in the CSS class. My tag looks like this currently: <img alt="my link" class="static" height="240" id="StaticImage" src="http://imageserver.com/myImage.jpg" width="240"> The static CSS class has width and height values of 300 each, and as you can see I'm trying to override them with 240. It's not working in this instance but can I do it without a second CSS class?

    Read the article

  • Override jQuery style value

    - by MrAwesome
    Hi To resolve a jQuery slideDown/Up problem, I had to change one line in the jQuery file. I changed line 5738 from this.elem.style.display = "block"; to this.elem.style.display = "inline-block"; The block attribute messed up my lists when using slideDown/Up/Toggle. slideDown changes my list from display:inline to display:block during execution, and then back to display: inline again. It would be much better if it was inline (or inline-block) all the way. Is there a way to override the value stated above from my html page, or do I have to stick with my modified jQuery file? It would be nice if I could override the style attribute only when I perform $('.gallery_container li:gt(4)').slideToggle(); Here's the code: http://90.230.237.71/gandhi.html

    Read the article

  • error C3662: override specifier 'new' only allowed on member functions of managed classes

    - by William
    Okay, so I'm trying to override a function in a parent class, and getting some errors. here's a test case #include <iostream> using namespace std; class A{ public: int aba; void printAba(); }; class B: public A{ public: void printAba() new; }; void A::printAba(){ cout << "aba1" << endl; } void B::printAba() new{ cout << "aba2" << endl; } int main(){ A a = B(); a.printAba(); return 0; } And here's the errors I'm getting: Error 1 error C3662: 'B::printAba' : override specifier 'new' only allowed on member functions of managed classes c:\users\test\test\test.cpp 12 test Error 2 error C2723: 'B::printAba' : 'new' storage-class specifier illegal on function definition c:\users\test\test\test.cpp 19 test How the heck do I do this?

    Read the article

  • Override java methods without affecting parent behaviour

    - by Timmmm
    suppose I have this classes (sorry it's kind of hard to think of a simple example here; I don't want any "why would you want to do that?" answers!): class Squarer { public void setValue(int v) { mV = v; } public int getValue() { return mV; } private int mV; public void square() { setValue(getValue() * getValue()); } } class OnlyOddInputsSquarer extends Squarer { @Override public void setValue(int v) { if (v % 2 == 0) { print("Sorry, this class only lets you square odd numbers!") return; } super.setValue(v); } } auto s = new OnlyOddInputsSquarer(); s.setValue(3); s.square(); This won't work. When Squarer.square() calls setValue(), it will go to OnlyOddInputsSquarer.setValue() which will reject all its values (since all squares are even). Is there any way I can override setValue() so that all the functions in Squarer still use the method defined there? PS: Sorry, java doesn't have an auto keyword you haven't heard about! Wishful thinking on my part.

    Read the article

  • flex: cant edit item in Datagrid with override set data method

    - by Markus
    Hi everybody, I've a custom itemRenderer for my datagrid. To set the actual data I use the following method: override public function set data(side:Object):void{ ... } As soon as I use this function the cell doesn't show up any item Editor anymore. Why is that? When I remove this function the itemEditor is working but with the wrong initialization data... What's the proper way to handle this? Thanks, Markus

    Read the article

  • AS3/Flex Override function in imported swf

    - by Riccardo
    I'm using a flex component that use a to load a .swf file. The loaded .swf - is passed to me as is and I can't edit - it has some as3 functions in it Is it possible in the "parent" application (the one with ) to override functions included in the "child" swf (the imported one)? And if it's possible, how? Thanks

    Read the article

  • How to override module classes in Kohana 3?

    - by Luke
    In Kohana 3, how can I override/extend a module class? E.g. I want to add functionality to the Auth module that is specific to my application. In this case I want to extend the abstract Auth class located in the classes folder of the Auth module. What naming convention should I use for my Auth class and where in the file system do I place my class file?

    Read the article

  • Override jsf implentation in WAS

    - by qasanov
    Hi everybody, I want to develop richface implented app on Ibm Websphere. I include *.jars under WEB-INF/libs and it runs succesfull. But first deployment proccess is realy terriable.. So I want to add libraries to server, not include in application. (i belevie it could increase 1st deployment).. Is there a way to override server impelemented JSf in server side? Thanks

    Read the article

  • @Override fix-code shortcut in NetBeans

    - by Bruce
    Hi guys, sorry for a silly question but I got angry after seeking the answer in NetBeans and in the net - is there any key shortcut for fixing @Override annotation in NetBeans (something like ctrl+shift+i for imports)? I do appreciate your answers, cheers.

    Read the article

  • Override jre_lib classes

    - by Filip
    What is the best way to override jre_lib classes? Let's say I need to store all ArrayLists not in RAM but on disk or anywhere else. I wanna write my own ArrayList class to code this functionality and make sure that every instantiations of ArrayList use my class. I thought about class loading mechanism to change order of classpath, but as I see java checks standard classes first.

    Read the article

  • WPF: RenderOptions.EdgeMode="Unspecified" vs "Alias" override global setting with local setting

    - by msfanboy
    Hello, in the ressource-tag of my MainWindowView.xaml I have this markup: RenderOptions.EdgeMode="Aliased" to get a general sharp look of my whole application. Using mostly rectangular shapes/controls this works fine. But for my validation error symbols I use a red ellipse with a white cross or "X" in it. The ellipse is using now the global "Aliased" settings what looks not good because I can see the pixelated border of the ellipse. Using now does NOT change anything ??? I always set in wpf local settings override global settings ?

    Read the article

  • Override Javascript Function Based on Passed Parameters

    - by George
    Is it possible to override a function based on the number of parameters that you are passing into it? For instance: function abc(name) { document.write ('My name is' + name); } function abc(name,friend) { document.write ('My name is' + name + 'and my best friend\'s name is' + friend); } So in the HTML if I just called abc(george) it would use the first version of the function, but if I called abc(george,john) it would use the second version. There may be other ways to accomplish the example I used, but I'm just wondering if the concept is sound in javascript.

    Read the article

  • Override default operations order in LINQ

    - by Erick
    For one of our applications we do use LINQ to update a few reccords of the database. For business reasons we do require that only one item of a list to be primary. When we designed we decided to fire all of queries at the database at once. The problems occurs when we add one row and update the primary element to be the second item. See, the default behavior for order of operations with LINQ is to Insert, Update, Delete. If I Insert a first element I get a check constraint error with SQL Server. The best in my opinion would be to override and make sure to Update before Insert, this way we make sure that check constraints are kept. Tho there is not a lot of documentation on the mather. Any idea ?

    Read the article

  • Override decimal ToString() method

    - by Jimbo
    I have a decimal datatype with a precision of (18, 8) in my database and even if its value is simply 14.765 it will still get displayed as 14.76500000 when I use Response.Write to return its value into a webpage. Is it possible to override its default ToString method to return the number in the format #,###,##0.######## so that it only displays relevant decimal places? UPDATE I'm assuming that when one outputs number on a page like <%= item.price %> (where item.price is a number) that the number's ToString method is being called? I'm trying to avoid having to change every instance where the value is displayed by defaulting the ToString() format somehow.

    Read the article

  • 'Must Override a Superclass Method' Errors after importing a project into Eclipse

    - by Tim H
    Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing the error 'The method ?????????? must override a superclass method'. It may be noteworthy to mention this is with Android projects - for whatever reason, the method argument values are not always populated, so I have to manually populate them myself. For instance: list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { //These arguments have their correct names } }); will be initially populated like this: list.setOnCreateContextMenuListener(new OnCreateContextMenuListener() { public void onCreateContextMenu(ContextMenu arg1, View arg2, ContextMenuInfo arg3) { //This methods arguments were not automatically provided } }); The odd thing is, if I remove my code, and have Eclipse automatically recreate the method, it uses the same argument names I already had, so I don't really know where the problem is, other then it auto-formatting the method for me. This becomes quite a pain having to manually recreate ALL my overridden methods by hand. If anyone can explain why this happens or how to fix it .. I would be very happy. Maybe it is due to the way I am formatting the methods, which are inside an argument of another method?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >