Search Results

Search found 2441 results on 98 pages for 'delegate'.

Page 58/98 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • Global variable call working only first time

    - by Ruthy
    Hello, I defined a global variable that is called from other view and it is working first time but not following ones, it keeps with value from first call! Suppose that is a cocoa fundamental problem and variable is not properly defined according its need. Thanks for any idea to solve it. declaration: @interface TableArchiveAppDelegate : NSObject <UIAppDelegate> { NSString *varName; } @property (nonatomic, copy) NSString *varName; then related lines on .m file: @synthesize varName; -(void)test{ varName = textField.text; } and request from another view: - (void)viewDidLoad { TableArchiveAppDelegate *mainDelegate = (TableArchiveAppDelegate *)[[UIApplication sharedApplication] delegate]; name.text = mainDelegate.varName; [super viewDidLoad]; }

    Read the article

  • .NET Compact COM interoperability

    - by markhor
    I have the following code in a full .NET framework solution: public delegate int CreateObjectDelegate( [In] ref Guid classID, [In] ref Guid interfaceID, [MarshalAs(UnmanagedType.Interface)] out object outObject); ... var createObject = (NativeMethods.CreateObjectDelegate) Marshal.GetDelegateForFunctionPointer( NativeMethods.GetProcAddress(_modulePtr, "CreateObject"), typeof (NativeMethods.CreateObjectDelegate)); object result; Guid interfaceId = _guid; Guid classID = _classId; createObject(ref classID, ref interfaceId, out result); The purpose is to create the needed COM object at runtime. Is it possible with any .NET compact framework? Note that it doesn't have Marshal.GetDelegateForFunctionPointer.

    Read the article

  • Ramifications of CheckForIllegalCrossThreadCalls=false

    - by Ron Skufca
    I recently updated an application from VS2003 to VS2008 and I knew I would be dealing with a host of "Cross-thread operation not valid: Control 'myControl' accessed from a thread other than the thread it was created on" I am handling this in what I beleive is the correct way (see code sample below). I am running into numerous controls that are going to need a similar fix. Not wanting to have similar code for every label, textbox etc.. that are being accessed by a non UI thread. What are the ramifications of just setting the CheckForIllegalCrossThreadCalls = false for the entire app? I found a CodeProject article with various workarounds and a warning at the bottom to NOT set the property. I am looking for other opinions/experiences on this issue. private void ShowStatus(string szStatus) { try { if (this.statusBar1.InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { ShowStatus(szStatus); })); } else { statusBar1.Panels[0].Text = szStatus; } } catch (Exception ex) { LogStatus.WriteErrorLog(ex, "Error", "frmMNI.ShowStatus()"); } }

    Read the article

  • Why cannot change Monotouch.Dialog.TableView.Background color

    - by BlueSky
    Why cannot change MonoTouch.Dialog.TableView.Background color ? I am using the Elements API of MonoTouch.Dialog. It's still gray! class MyDialogViewController : DialogViewController { public MyDialogViewController (RootElement root) : base (root) { } public override void LoadView () { base.LoadView (); TableView.BackgroundColor = UIColor.Clear; UIImage background = UIImage.FromFile ("Mybackground.png"); ParentViewController.View.BackgroundColor = UIColor.FromPatternImage (background); } } public partial class MyVC: UINavigationController { public void CreateTestUI() { var menu = new RootElement("MyMenu"){ new Section ("test"){ new StringElement("Test", delegate() { }), ... var dv = new MyDialogViewController (menu) { Autorotate = true }; // add the nav controller to the window this.PushViewController (dv, true); } }

    Read the article

  • How is method group overload resolution different to method call overload resolution?

    - by thecoop
    The following code doesn't compile (error CS0123: No overload for 'System.Convert.ToString(object)' matches delegate 'System.Converter<T,string>'): class A<T> { void Method(T obj) { Converter<T, string> toString = Convert.ToString; } } however, this does: class A<T> { void Method(T obj) { Converter<T, string> toString = o => Convert.ToString(o); } } intellisense gives o as a T, and the Convert.ToString call as using Convert.ToString(object). In c# 3.5, delegates can be created from co/contra-variant methods, so the ToString(object) method can be used as a Converter<T, string>, as T is always guarenteed to be an object. So, the first example (method group overload resolution) should be finding the only applicable method string Convert.ToString(object o), the same as the method call overload resolution. Why is the method group & method call overload resolution producing different results?

    Read the article

  • Adding row to DataGridView from Thread

    - by she hates me
    Hello, I would like to add rows to DataGridView from two seperate threads. I tried something with delegates and BeginInvoke but doesn't work. Here is my row updater function which is called from another function in a thread. public delegate void GRIDLOGDelegate(string ulke, string url, string ip = ""); private void GRIDLOG(string ulke, string url, string ip = "") { if (this.InvokeRequired) { // Pass the same function to BeginInvoke, // but the call would come on the correct // thread and InvokeRequired will be false. object[] myArray = new object[3]; myArray[0] = ulke; myArray[1] = url; myArray[2] = ip; this.BeginInvoke(new GRIDLOGDelegate(GRIDLOG), new object[] { myArray }); return; } //Yeni bir satir daha olustur string[] newRow = new string[] { ulke, url, ip }; dgLogGrid.Rows.Add(newRow); }

    Read the article

  • How to add ACTIVE DOMAIN user to Sharepoint group

    - by standley-nguyen
    Hi all. I got an exception when executing this snippet code SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(siteUrl.Trim())) { using (SPWeb web = site.OpenWeb()) { try { web.AllowUnsafeUpdates = true; SPUser spUser = web.AllUsers[userName]; if (spUser != null) { SPGroup spGroup = web.Groups[groupName]; if (spGroup != null) spGroup.AddUser(spUser); } } catch (Exception ex) { this.TraceData(LogLevel.Error, "Error at function Named [AddUserToSPGroupWidget.AddUserToGroup] . With Error Message: " + ex.ToString()); } finally { web.AllowUnsafeUpdates = false; } } } }); PLease guide me. Thanks in advance.

    Read the article

  • Access denied when using RunWithElevatedPrivileges?

    - by James123
    I want regular user can access the "User Information List" in Mysite root site. I am using "RunWithElevatedPrivileges" method. Still throwing access denied error. per example my root site collection for mysite is "http://network.test.com". the user want assess userinformation list this site collection. How can he access that? SPSecurity.RunWithElevatedPrivileges(delegate { using (SPSite site = new SPSite(SPContext.Current.Web.Site.ID)) { ServerContext sc = ServerContext.Current; UserProfileManager upm = new UserProfileManager(sc); UserProfile up = null; //get current user's profile (visitor) if (upm.UserExists(SPContext.Current.Web.CurrentUser.LoginName)) { up =upm.GetUserProfile(SPContext.Current.Web.CurrentUser.LoginName); SPWeb web = SPContext.Current.Web; SPList userInformationList = web.Lists["User Information List"];

    Read the article

  • Writing asynchronously on a stream in cocoa

    - by Richard Ibarra
    Hi folks I have been trying to find any way for writing asynchronously on a stream in Cocoa. I have a set of events in my applications which will try to send data through the socket but i can't be blocked during this transmission due to design terms. I have tried setting a delegate on the output stream and check the event NSStreamEventHasSpaceAvailable but I don't know how this can be combined with the events that put data into the stream. Is there anyway for doing that? I thought using NSThread but I guess there is a better option. Cheers

    Read the article

  • Issues dismissing keyboard conditionally with on iPhone

    - by Chris
    I have an app that has a username and password field. I want to validate the input before the the user is allowed to stop editing the field. To do that, I'm using the textFieldShouldEndEditing delegate method. If the input doesn't validate I display a UIAlertView. This approach works as advertised - the user cannot leave the field if the input doesn't validate. To have the done button on the keyboard dismiss the keyboard, I call resignFirstResponder on the textfield. The issue I have is the alert is being called twice. How do I keep the alert from showing twice?

    Read the article

  • PLCameraController is not adding in viewcontroller

    - by sujyanarayan
    Hi, I've declared PLCameraContoller instance in my AppDelegate class as:- self.cameraController = [PLCameraController performSelector:@selector(sharedInstance)];[cameraController setDelegate:self]; And I'm accessing it in one of my viewcontroller class as:- del = [[UIApplication sharedApplication] delegate]; UIView previewView = [del.cameraController performSelector:@selector(previewView)]; previewView.frame = CGRectMake(0,0, 320, 480); self.view = previewView; [del.cameraController performSelector:@selector(startPreview)]; [del.cameraController performSelector:@selector(setCameraMode:) withObject:(NSNumber)1]; Where "del" is an instance of my AppDelegate class. But i can see only black background in my viewcontroller view in iphone device. Also if i remove "self" from the appdelegate.m code of cameracontroller it also showing blank. How can i get camera in my view controller? I'm pretty much struggling with it. Thanks in Adv.

    Read the article

  • UIActionSheet cancel button strange behaviour

    - by nevan
    I have a UIBarButtonItem opening an action sheet to offer users choices about what to do. Everything works as expected unless I try to click on the "Cancel" button. The target of the button appears to have moved up from where it should be. I can only activate it by clicking somewhere in the middle of the "Cancel" and "Ok" buttons. I've tried at action sheets in other applications and they work fine, so it's not just my big thumb. The action sheet is opening in a UIViewController - (void)showOpenOptions { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Open link in external application?", @"Open in external application") delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel") destructiveButtonTitle:NSLocalizedString(@"Open Link", @"Open Link") otherButtonTitles:nil]; [sheet showInView:self.view]; [sheet release]; }

    Read the article

  • Dragging Files on the Dock Icon

    - by enchilada
    I know how handle dragging of files on the dock icon, and it has been asked before. However, I'm wondering, can I somehow get more control? For example, can I make the dock icon reject files that are not in the user's folder and allow only files that are in the user's folder? I'd rather do that instead of the app appearing as if it handles files outside the user's folder, and then within the app delegate afterwards reject the files by detecting the file paths. That doesn't seem good from a user's perspective.

    Read the article

  • My view is displaying y=-20 dispite its frame set to y=0. After rotation it snaps back to y=0

    - by jamone
    I started by creating a universal window based app. Starting with the iPhone version I created a UIViewController and associated nib. My App delegate: rootViewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; [window makeKeyAndVisible]; [window addSubview:rootViewController.view]; return YES; My RootViewController: - (void)viewDidLoad { [super viewDidLoad]; adBannerView = [[ADBannerView alloc] initWithFrame:CGRectZero]; [self.view addSubview:adBannerView]; } I've tried instanciating buttons instead of the adBanner and I get the same result. My RootViewController's nib has not been changed since x-code created it for me. My MainWindow_iPhone.xib also is stock. What's causing this?

    Read the article

  • LINQ query needs either ascending or descending in the same query

    - by Sir Psycho
    Is there anyway this code can be refactored? The only difference is the order by part. Idealy I'd like to use a delegate/lamda expression so the code is reusable but I don't know how to conditionally add and remove the query operators OrderBy and OrderByDescending var linq = new NorthwindDataContext(); var query1 = linq.Customers .Where(c => c.ContactName.StartsWith("a")) .SelectMany(cus=>cus.Orders) .OrderBy(ord => ord.OrderDate) .Select(ord => ord.CustomerID); var query2 = linq.Customers .Where(c => c.ContactName.StartsWith("a")) .SelectMany(cus => cus.Orders) .OrderByDescending(ord => ord.OrderDate) .Select(ord => ord.CustomerID);

    Read the article

  • Invalidating session before iPhone application quits

    - by tartox
    Hello I would like to tell the server to invalidate an ongoing session when the user quits the iPhone application. In the app delegate, I send a request to the server in the (void)applicationWillTerminate:(UIApplication *)application method. I am not waiting for a server answer, I just want to send the request and quit. However I cant see any packet leaving the application. The same code in another place works fine. Session has a limited duration anyway and the server will invalidate it after a while, but I would prefer to do it nicely when leaving application. Is it normal that no NSURLConnection can be established from the applicationWillTerminate method ? Thank you.

    Read the article

  • Facebook writing on a wall problem - retrieves only null value.

    - by Viral
    hi all friends, I am making a game application in that I want to pass my score on wall of face book. I've completed all the things (the log in and message passing part) but when I passes the score via global variable, I am getting only null as a value and not the score that I want. Is there any way to pass data or string to Face book and write on a wall? My code is (void)viewDidLoad { static NSString* kApiKey = @"be60415be308e2b44c0ac1db83fe486b"; static NSString* kApiSecret = @"4f880c7e100321f808c41b1d3c813dfa"; _session = [[FBSession sessionForApplication:kApiKey secret:kApiSecret delegate:self] retain]; score = [NSString stringWithFormat:@"%@",appDelegate.myTextView]; [_session resume]; [super viewDidLoad]; } whre score is NSString and myTextView is NSString in other viewcontrollerfile, And appDelegate is global variable. Any help?? thanks in advance.

    Read the article

  • how to modify this jquery syntax

    - by Gandalf StormCrow
    Hi all, this example below works when hover event is trigered and when its not, its working for elements already in DOM, but when element created dynamically it doesn't work, I realize I need to use jQuery live() or delegate() for this, the thing is I tried to modify it and its not producing the results as expected, here is the working code : $(".sidebar li").hover( function(){ $(this).css("background-color", "#F9F4D0"); $(this).append($('<button class="promoter" type="button" title="Active promotion"></button>')); }, function(){ $(this).css("background-color", "#F9FAFA"); $(this).children("button").remove(); } ); Here is the bit when I wanted to add live but it's not producing correct results : $(".sidebar li").live('hover', function(){ $(this).css("background-color", "#F9F4D0"); $(this).append($('<button class="promoter" type="button" title="Active promotion"></button>')); }, function(){ $(this).css("background-color", "#F9FAFA"); $(this).children("button").remove(); } ); Where did I made mistake, thank you

    Read the article

  • creative way for implementing Data object with it's corespanding buisness logic class in java

    - by ekeren
    I have a class that need to be serialized (for both persistentcy and client-server communication) for simplicity reasons lets call the classes Business a BusinessData and I prefix for their Interfaces. All the getter and setter are delegated from Business class to BusinessData class. I thought about implementing IBusinessData interface that will contain all the getter and setters and IBusiness interface that will extend it. I can either make Business extend BuisnessData so I will not need to implement all getter and setter delegates, or make some abstract class ForwardingBusinessData that will only delegate getter and setters. Any of the above option I loose my hierarchy freedom, does any of you have any creative solution for this problem... I also reviewed DAO pattern: http://java.sun.com/blueprints/patterns/DAO.html

    Read the article

  • Playing audio from a wav file in iPhone SpeakHere example

    - by Mo
    I'm working with the iPhone SpeakHere example, and I would like to be able to play audio from either the mic (as in the example) or from a wav file. I have working code to play from a particular wav file, which looks like this: NSString *path = [[NSBundle mainBundle] pathForResource:@"basketBall" ofType:@"wav"]; AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL]; theAudio.delegate = self; [theAudio play]; So I'm fine with actually getting the wav to play in the application (I can hook it up to a button, etc.) but I would like it to also behave the same way pushing the "Play" button does after recorded speech, in that it should be connected to the same visualization (which I have modified quite a bit, but essentially shows the current volume, among other things). Thanks for your help!

    Read the article

  • Cocoa -- getting a simple NSImageView to work

    - by William Jockusch
    I am confused about why this code does not display any image: In the app delegate: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSRect rect = window.frame; rect.origin.x = 0; rect.origin.y = 0; BlueImageView *blueImageView = [[BlueImageView alloc]initWithFrame:rect]; window.contentView = blueImageView; // also tried [window.contentView addSubview: blueImageView]; } BlueImageView.h: @interface BlueImageView : NSImageView { } @end BlueImageView.m: @implementation BlueImageView - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { [self setImage: [NSImage imageNamed:@"imagefile.png"]]; NSAssert(self.image, @""); NSLog (@"Initialized"); } return self; } - (void)drawRect:(NSRect)dirtyRect { } @end The file imagefile.png exists. The NSAssert is not causing an exception. The NSLog is firing. But no image shows up in the window.

    Read the article

  • Authorization in a more purely OOP style...

    - by noblethrasher
    I've never seen this done but I had an idea of doing authorization in a more purely OO way. For each method that requires authorization we associate a delegate. During initialization of the class we wire up the delegates so that they point to the appropriate method (based on the user's rights). For example: class User { private deleteMemberDelegate deleteMember; public StatusMessage DeleteMember(Member member) { if(deleteMember != null) { deleteMember(member); } } //other methods defined similarly... User(string name, string password) //cstor. { //wire up delegates based on user's rights. //Thus we handle authentication and authorization in the same method. } } This way the client code never has to explictly check whether or not a user is in a role, it just calls the method. Of course each method should return a status message so that we know if and why it failed. Thoughts?

    Read the article

  • Objective-C Framework PSMTabBarControl does not work

    - by ahmet2106
    Hello everybody In my App I'm trying to get PSMTabBarControl working, but all I do - nothing... I have copied the framework File in my Frameworks folder of my App, then included it. In my InterfaceBuilder (1.3.2) I was able to drag and drop the PSMTabBarControl to my Window and link it with the NSTabView (PSM - tabView - NSTabView && NSTabView - delegate - PSM), but after i tried a Demo (apple+r) I cant see the Tabs... Tried all I can - but dont know why.. Am I doing sth. wrong? Which other Framework or Source I can use to create Tabs like Firefox oder Safari? Thank you!

    Read the article

  • Conceptual question about NSAutoreleasePools

    - by ryyst
    In my Cocoa program, wouldn't a really simple way of dealing with autoreleased objects be to just create a timer object inside the app delegate that calls the following method e.g. every 10 seconds: if (pool) { // Release & drain the current pool to free the memory. [pool release]; } // Create a new pool. pool = [[NSAutoreleasePool alloc] init]; The only problems I can imagine are: 1) If the above code runs in a separate thread, an object might get autoreleased between the release call to the old pool and the creation of the new pool - that seems highly unlikely though. 2) It's obviously not that efficient, because the pool might get released if there's nothing in it. Likewise, in the 10 second gap, many many objects might be autoreleased, causing the pool to grow a lot. Still, the above solution seems pretty suitable to small and simple projects. Why doesn't anybody use it? What's the best practice of using NSAutoreleasePools?

    Read the article

  • Async call Objective C iphone

    - by Sam
    Hi guys, I'm trying to get data from a website- xml. Everything works fine. But the UIButton remains pressed until the xml data is returned and thus if theres a problem with the internet service, it cant be corrected and the app is virtually unusable. here are the calls: { AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; if(!appDelegate.XMLdataArray.count > 0){ [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [appDelegate GetApps]; //function that retrieves data from Website and puts into the array - XMLdataArray. } XMLViewController *controller = [[XMLViewController alloc] initWithNibName:@"MedGearsApps" bundle:nil]; [self.navigationController pushViewController:controller animated:YES]; [controller release]; } It works fine, but how can I make the view buttons functional with getting stuck. In other words, I just want the UIButton and other UIButtons to be functional whiles the thing works in the background. I heard about performSelectorInMainThread but i cant put it to practice correctly any help is appreciated :)

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >