Thread: [Fxruby-users] Scintilla FXDataTarget Bug?
Status: Inactive
Brought to you by:
lyle
From: Joseph <rub...@te...> - 2004-06-17 02:03:40
|
Hi. Jeroen, thanks for enlightening me (in more detail) to layout management and FXSplitter. It came in handy. A new problem: I was experimenting with FXDataTarget, FXText, and FXScintilla. The FXScintilla widget does not appear to be working with FXDataTarget objects. In Detail (code follows below) I have a FXText widget, and a FXScintilla widget. Each is connected to its own FXDataTarget instance. I initialize the two FXDataTarget instances to a static value, and then implement a button handler that prints out the value of both FXDataTarget instances. 1. The static text assigned to the DataTarget associated with the FXText instance is displayed in the FXText widget, however, FXScintilla does not display the text assigned to the DataTarget associated with the FXScintilla widget. 2. If I type something into both the FXText widget, as well as the FXScintilla widget, then the DataTarget associated with the FXText now contains the text that was entered interactively, whereas the DataTarget prints the text that was originally assigned to the DataTarget programmatically. I.e. if I hit the "Print" button, then the new value is printed for the FXText DataTarget, but the Scintilla DataTarget does not print the modified contents that was typed into the Scintilla widget. Is FXScintilla forgetting to update the associated FXDataTarget instance? Here are the code snippets, plus results: #>>>>>>>>>>>>> @textTarget = FXDataTarget.new("") @msgTarget = FXDataTarget.new("") @msgTarget.value = "static msgTest value" @textTarget.value = "static testTarget value" printButton = FXButton.new(buttons, "&Print") printButton.connect(SEL_COMMAND) do |sender, selector, data| print "@textTarget.value = [" + @textTarget.value + "]\n" print "@msgTarget.value = [" + @msgTarget.value + "]\n" end @tx = FXText.new(textframe, @textTarget, FXDataTarget::ID_VALUE, TEXT_WORDWRAP | LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y) @sctl = FXScintilla.new(sctlframe, @msgTarget, FXDataTarget::ID_VALUE, LAYOUT_SIDE_TOP | LAYOUT_FILL_X | LAYOUT_FILL_Y) #<<<<<<<<<<<<< @textTarget.value = [FXText test] @msgTarget.value = [static msgTest value] Any ideas? TIA, Joseph |
From: Lyle J. <ly...@kn...> - 2004-06-17 10:13:32
|
On Jun 16, 2004, at 9:04 PM, Joseph wrote: > I was experimenting with FXDataTarget, FXText, and FXScintilla. The > FXScintilla widget does not appear to be working with FXDataTarget > objects. OK, after a quick scan of the FXScintilla source code it looks like you're right. > Any ideas? You can certainly file a change request with Gilles Filippini, the author of the FXScintilla widget, to get support for working with data targets. In the meantime, however, I think you're going to have to add a lot of "bootstrapping" code for this yourself. For example, when you modify the data target's value directly, you should make the corresponding change to the FXScintilla widget: @msgTarget.value = "foo" @sctl.setText(@msgTarget.value) Similarly, you would need to catch the SEL_CHANGED message from FXScintilla to know when the user is changing things there, and then copy the new text into your string variable. Obviously, this is the kind of tedium that data target was invented to avoid, so if you can get Gilles to make that change it's all the better for all of us. ;) Hope this helps, Lyle |
From: jeroen <je...@fo...> - 2004-06-18 04:11:56
|
On Wednesday 16 June 2004 09:04 pm, Joseph wrote: > Hi. > > Jeroen, thanks for enlightening me (in more detail) to layout management > and FXSplitter. It came in handy. > > A new problem: > I was experimenting with FXDataTarget, FXText, and FXScintilla. The > FXScintilla widget does not appear to be working with FXDataTarget objects. > In Detail (code follows below) > I have a FXText widget, and a FXScintilla widget. Each is connected to > its own FXDataTarget instance. I initialize the two FXDataTarget > instances to a static value, and then implement a button handler that > prints out the value of both FXDataTarget instances. > 1. The static text assigned to the DataTarget associated with the FXText > instance is displayed in the FXText widget, however, FXScintilla does > not display the text assigned to the DataTarget associated with the > FXScintilla widget. > 2. If I type something into both the FXText widget, as well as the > FXScintilla widget, then the DataTarget associated with the FXText now > contains the text that was entered interactively, whereas the DataTarget > prints the text that was originally assigned to the DataTarget > programmatically. I.e. if I hit the "Print" button, then the new value > is printed for the FXText DataTarget, but the Scintilla DataTarget does > not print the modified contents that was typed into the Scintilla widget. Of course, its up to FXScintilla to issue the messages [and handle the ID_GETSTRINGVALUE messages] so that the datatarget system works. However, for such large chunks of text as you can have in an editor it is a bit of an expensive mechanism. So I'd suggest to think twice about using it even if the FXScintilla text component does implement it fully [unless of course you don't expect a lot of text; with small bits of text it should not be a problem]. Regards, Jeroen -- +----------------------------------------------------------------------------+ | Copyright (C) 23:50 12/11/2003 Jeroen van der Zijp. All Rights Reserved. | +----------------------------------------------------------------------------+ |