Author Topic: Deleting and renaming event handlers in wxsmith.  (Read 9421 times)

Offline nishalns

  • Multiple posting newcomer
  • *
  • Posts: 22
Deleting and renaming event handlers in wxsmith.
« on: July 25, 2013, 03:35:10 pm »
While programming, we add components and for handling events, we need event handlers. No doubt, wxsmith provides a method for creating these event handlers. But sometimes, suppose, this component becomes unnecessary, and I want to delete it. No doubt, there is a feature for that as well. But the event handlers associated with it are not deleted. Also, sometimes these event handlers become useful for some other new component. In such a case, we might want to rename the event handler name. This renaming can be made manually. But this is not affected in the wxsmith interface. So, I would like to request the code::blocks development team to implement this feature in the next nightly.

But I don't mean to say that the event handler should get deleted while deleting the components with which it is associated. They should be deleted as per the wish and will of the programmer.

I'm sorry if this feature is already implemented. Please let me know if it is so...

Thank you very much for this great IDE. It is my favourite IDE. It has made my development quick, reliable and cheap.
« Last Edit: July 25, 2013, 03:40:15 pm by nishalns »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Deleting and renaming event handlers in wxsmith.
« Reply #1 on: July 25, 2013, 03:51:08 pm »
Could you give use a example and steps about your feature request?

Suppose you have a component named gui1, and you have a function(event handler for it) like handler1().
Now, you delete the gui1 from the GUI designer, so the handler1()'s declaration and implementation is deleted?
Then, you add gui2, and you want to band gui2 to handler1?

Please tell us details, thanks.

I'm not familiar with wxsmith source code, I just give some suggestions. :)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline nishalns

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Deleting and renaming event handlers in wxsmith.
« Reply #2 on: July 26, 2013, 05:38:54 am »
Suppose, I have a button 'btn1'. Now, when I double click on 'btn1', an event handler'Onbtn1Click' is created by code::blocks. After sometime, I want to delete 'btn1'. When this is done, the event handler should not be deleted. Say, I go on to finish the project and at the end I find that this event handler is useless. Then I should be able to delete it.

But sometimes I feel like renaming 'btn1' to 'btn2'(say). Then, just to make it more readable, I should be able to rename the event handler to 'Onbtn2Click'.

The above to cases are examples, and I should be able do delete or rename them at any time I want.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Deleting and renaming event handlers in wxsmith.
« Reply #3 on: July 26, 2013, 05:54:05 am »
Suppose, I have a button 'btn1'. Now, when I double click on 'btn1', an event handler'Onbtn1Click' is created by code::blocks. After sometime, I want to delete 'btn1'. When this is done, the event handler should not be deleted. Say, I go on to finish the project and at the end I find that this event handler is useless. Then I should be able to delete it.

But sometimes I feel like renaming 'btn1' to 'btn2'(say). Then, just to make it more readable, I should be able to rename the event handler to 'Onbtn2Click'.

The above to cases are examples, and I should be able do delete or rename them at any time I want.
wxsmith does not have much renaming feature, but at any place, you can use the replace tool supplied by C::B, for me, it is CTRL+ R, then I can replace on h/cpp files, that does not take much time. But I'd say it is better that wxsmith can have such renaming feature.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline nishalns

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Deleting and renaming event handlers in wxsmith.
« Reply #4 on: July 26, 2013, 06:11:24 am »
But, if I rename using that method(ctrl+R), then will it be affected in the wxSmith interface.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6077
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Deleting and renaming event handlers in wxsmith.
« Reply #5 on: July 26, 2013, 06:14:20 am »
But, if I rename using that method(ctrl+R), then will it be affected in the wxSmith interface.
? I don't understand your problem.

For me, you can close the wxs gui editor, then you can open wxs file in text format, they are just xml text files. so you can rename any variables as the same as h/cpp files. After that, you can open the wxs file in the GUI editor again.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline nishalns

  • Multiple posting newcomer
  • *
  • Posts: 22
Re: Deleting and renaming event handlers in wxsmith.
« Reply #6 on: July 26, 2013, 06:28:57 am »
Oh! Thanks ollydbg. Actually I was referring to the wxs file. Now I understand how to do it. Thank you very much...
But I think it would be better to have a rename function in wxsmith, won't it?.