subclassing

How to disable select functionality in UITextView?

I want to create a text display area (either UILabel or UITextView) in my iPhone app which (1) allows scrolling and (2) does not allow selection. I have tried the following techniques unsuccessfully: Basic UILabel: Didn't allow scrolling, and clipped text to the bottom of UILabel space on screen. Giant UILabel within a UIScrollView: th...

Modeling question about categorization. To subtype or not to?

I need some advice on how to model this simple categorization (?) example: I have a product. A product can be of different types, such as ProductType 1, ProductType 2, and ProductType 3. All products have a part number and a name. Where they differ, is the way their prices are calculated. Products in type 1's price are dependent on how...

Returning object of dynamically allocated class from method.

This probably has a very simple solution, but I can't seem to figure it out... We have a bunch of classes of the form xQuantity, e.g. DistanceQuantity, AreaQuantity, etc., which extend a class DimensionQuantity. Now you can add or subtract DistanceQuantity's or AreaQuantity's, etc., but you can't mix them. All of the subclasses have met...

How to turn off beeping when pressing ENTER on a single-line EDIT control under Windows CE?

Hello, I'm developing an application targeted to a POCKET PC 2003 (Windows CE 4.2) device using C++ and native WINAPI (i.e. no MFC or the like). In it I have a single-line edit control which part of the main window (not a dialog); hence the normal behaviour of Windows when pressing ENTER is to do nothing but beep. I've subclassed the w...

Returning subclass object from superclass method

I keep coming back to variants of this problem: it probably has a very simple solution, but I can't seem to figure it out... I have a bunch of classes of the form xQuantity, e.g. DistanceQuantity, AreaQuantity, etc., which extend a class DimensionQuantity. Now you can add or subtract DistanceQuantity's or AreaQuantity's, etc., but you c...

How can I add a test method to a group of Django TestCase-derived classes?

Hi all, I have a group of test cases that all should have exactly the same test done, along the lines of "Does method x return the name of an existing file?" I thought that the best way to do it would be a base class deriving from TestCase that they all share, and simply add the test to that class. Unfortunately, the testing framework ...

Subclassing UINavigationBar in Xcode

Hi, I am wanting to apply a custom alpha value to the title of the UINavigationBar. The UINavigationBar is part of the UINavigationController and the UINavigationController is part of a UITabBarController. Edit: Here is a picture of what I created using a UIToolbar and a UILabel. I want to do the same using the title in the UINavigatio...

How can I get a custom CallableStatement object out of a prepareCall method.

I want to create a subclass that extends the CallableStatement object. I want to do this so I can override the execute and executeQuery methods to track some metrics on each SP call. Currently I have code that looks like this: Connection db = poolingDataSource.getConnection(); CallableStatement cstmt = db.prepareCall("{call pSampleSto...

Subclass/Superclass - If a subclass is cast as its superclass, is there a way to use the overloaded properties of the subclass?

Sorry if the title isn't very clear. This is a VB.NET (2010) question I have a superclass called "Device" which has a number of subclasses that inherit it. Some of those subclasses also have subclasses. In particular, I have a class called "TwinCatIntegerDevice" which inherits "TwinCatDevice" which inherits "Device." The relevant pa...

Why does this line indefinitely repeat?

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ UITableViewCellFixed *cell = (UITableViewCellFixed *)[tableView cellForRowAtIndexPath:indexPath]; the second line (ie: the first line after the function is declared) is repeating itself indefinitely. I have no idea why. I got a stack ov...

overriding PHP class methods referenced by non-overridden $this

So, I'm having trouble with some php OO stuff. I think the code will explain it best: class foo { $someprop; public function __construct($id){ $this->populate($id); } private function populate($id){ global $db; // obviously not the call, but to illustrate the point: $items = $db->get_fro...

Guide about subclassing

Hi! I'd like to create a subclass of UIAlertView to implement my own defaut behaviors when users click on the dialog's buttons. It would be awesome if someone would guide me through it or just point me to some guide about subclassing? Thanks! ...

How to keep an array sorted

I'm refactoring a project that involves passing around a lot of arrays. Currently, each method that returns an array sorts it right before returning it. This isn't ideal for a couple reasons -- there's lots of duplicated code, it's inefficient to sort an array two or three times, and it's too easy to write a new function but to forget ...

Using a custom UITableView without linking in IB

I have a custom UITableView class for creating shadow effects on all of my UITableViews. Is it possible to incorporate this class with my UITableViewController(s) without creating a nib file for each table view controller? Is there another way to link this custom UITableView other then in IB? ...

Subclassing tab control

What is the proper way to subclass a tab control in winAPI, having windows perform both the default drawing and your own. Because BeginPaint() and EndPaint() are calling within the default proc, I don't see a way to do this. I did get it working with GetDC(), but it had a very bugs which annoyed the hell out of me. If what I am asking i...

iPhone - SubClassing UIToolbar the right way ???

I created a new Class named CustomToolbar Then i created an empty nib, added a toolbar to it, and set the toolbar class to "CustomToolbar". What is the proper way of initializing CustomToolbar In code so that my class uses the nib file? I already have written the code to do that but i know it's not the correct way and it has a leak. ...

What to consider before subclassing list?

Hi, I was recently going over a coding problem I was having and someone looking at the code said that subclassing list was bad (my problem was unrelated to that class). He said that you shouldn't do it and that it came with a bunch of bad side effects. Is this true? I'm asking if list is generally bad to subclass and if so, what are th...

Problems with 'cross process subclassing'

Two questions. 1) I understand this must be an expected outcome but maybe someone can tell me what I'm doing wrong; I'm trying to subclass all window classes in a global hook and it works except that I'm not able to close shop as I should and when the program initially registering the hook unregisters the hook and exits, subclassed appl...

Overriding a variadic method in objective-c

When subclassing in objective-c, how can I forward a call to the superclass in the case of a variadic method. By what should I replace the ??? below to send all the objects I got? - (void) appendObjects:(id) firstObject, ... { [super appendObjects: ???]; } ...