ive found that with using stringfindstr 0 if the character is not found instead of returning like -1 or something

occi ? I'm new to the whole mess and got an error i cant get rid of…

in this case, the wanted text edit widget depends on which editor is in use, since it'
*since it's a tabbed editor
with multiple files open at once

another way to tackle this sort of thing is the model-view-controller pattern, where all your data is in one place and the widgets just have pointers to the data

not quite sure what you mean
isn't that barely one step above globals?
or would it be something like

a model-view-controller system has a model (a bunch of data), views (usually UI to display the data), and controllers (UI commands that manipulate the data).

my widgets library all but dictates that it's controls hold the data
i'm using wxwidgets
I don't know of a way of telling it "text ctrls, hold your text here instead"

so instead of what you have now (data spread over the UI widgets), you put all the data in a single model object (or probably a group of objects). Then the UI just updates the model object.
you don't, you tell the text controls "if the data changes, copy it to here"

hmm. what would that buy me? most of the time the ugly code is resulting from needing to call methods on the widgets, not needing data from them

you'd need a way for the controller to call back to the widgets too ("if this text data changes, tell the widget about it")

I can't point out a single line where needing data is the problem off the top of my head, but I can point out 5 cases where ugliness results from needing to tell another widget to do something as a result of it's sibling doing something

can someone link me to an idiomatic way to strip newlines from a string?

it cleans things up by forcing the interaction between widgets to become interaction with the model

please listen to others rather than me, as they are probably better at it, but
while(string.find("\n") != string

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: