×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Dec 2004
    Posts
    101

    Assign CoeControl to another

    I saw this code work on some posts , but it did not work for me
    ERROE:
    Illegal assignment to const
    Code:
    iFocusControl = ComponentControl(index); //Illegal assignment to const

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Assign CoeControl to another

    "Illegal assignment to const" probably means that iFocusControl is const in the given context.
    Either it is declared as const in the header file (this is unlikely), or you are trying to use this line in a const method (like Draw).
    Methods in the form "X::Y(...) const" say that they are not going to modify the object, thus every member variable is treated as const.
    If you really need this assignment, you can cast away const-ness with const_cast operator
    Code:
    const_cast<CYourClass*>(this)->iFocusControl=ComponentControl(index);

  3. #3
    Regular Contributor
    Join Date
    Dec 2004
    Posts
    101

    Re: Assign CoeControl to another

    Thanks for answer what about this
    Code:
    iFocusControl = const_cast<MyClass*>(this)->ComponentControl(index);

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: Assign CoeControl to another

    If it compiles, it is fine.

Similar Threads

  1. how to assign ip address
    By belagalshravan in forum Symbian
    Replies: 1
    Last Post: 2009-10-14, 02:20
  2. How to Assign Speed Dials
    By pistha in forum Symbian
    Replies: 9
    Last Post: 2009-04-21, 14:09
  3. using of CoeControl
    By xchewy in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-06-09, 11:44
  4. Assign ringing tones to contacts?
    By ismalg in forum Symbian
    Replies: 16
    Last Post: 2007-01-25, 10:14
  5. Assign file type to application?
    By stowey in forum Mobile Java General
    Replies: 1
    Last Post: 2005-11-09, 04:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×