Forum Replies Created
-
AuthorPosts
-
gmauro
ParticipantYes, I have modified EditControl in this way:
in the New method you must replace:
New(mandatory = false, readonly = false, style = 0, bgndcolor = "",
textcolor = "", hidden = false, tabover = false)
{
...
...
if Object?(bgndcolor)
bgndcolor = RGB(bgndcolor[0], bgndcolor[1], bgndcolor[2])
.SetBgndColor(bgndcolor)
if Object?(textcolor)
textcolor = RGB(textcolor[0], textcolor[1], textcolor[2])
.textcolor = textcolor
}with this:
New(mandatory = false, readonly = false, style = 0, hidden = false, tabover = false
bgndcolor = "", textcolor = "", bgndcolor_readonly = "", textcolor_readonly = "")
{
...
...
if Object?(bgndcolor)
bgndcolor = RGB(bgndcolor[0], bgndcolor[1], bgndcolor[2])
.SetBgndColor(bgndcolor)
if Object?(bgndcolor_readonly)
bgndcolor_readonly = RGB(bgndcolor_readonly[0], bgndcolor_readonly[1], bgndcolor_readonly[2])
if (bgndcolor_readonly == "")
.SetReadOnlyBgndColor(RGB(240, 240, 240))
else
.SetReadOnlyBgndColor(bgndcolor_readonly)
if Object?(textcolor)
textcolor = RGB(textcolor[0], textcolor[1], textcolor[2])
.textcolor = textcolor
if Object?(textcolor_readonly)
textcolor_readonly = RGB(textcolor_readonly[0], textcolor_readonly[1], textcolor_readonly[2])
.textcolor_readonly = textcolor_readonly
}Then you have to add these methods:
SetReadOnlyBgndColor(color)
{
.bgndcolor_readonly = color is "" ? RGB(240, 240, 240) : color
.bgndbrush_readonly = color is "" ? GetStockObject(SO.WHITE_BRUSH) : CreateSolidBrush(color)
.color_readonly = .bgndcolor_readonly
.brush_readonly = .bgndbrush_readonly
.Repaint()
}
CTLCOLORSTATIC(wParam) //this is for the readonly case
{
if .textcolor_readonly isnt ""
SetTextColor(wParam, .textcolor_readonly)
SetBkColor(wParam, .color_readonly)
return .brush_readonly
}With these mods, you can do something like:
w1 = Window(#(Vert (Editor font: “Verdana” size: 16 readonly: false)))
w1.Vert.Editor.Set(“Hello”)
w1.Vert.Editor.SetBgndColor(RGB(255,0,0))
w1.Vert.Editor.SetReadOnlyBgndColor(RGB(0,255,0))w1.Vert.Editor.SetReadOnly(true) // <-- this will make the editor readonly and the background green w1.Vert.Editor.SetReadOnly(false) // <-- this will make the editor editable and the background red
gmauro
ParticipantThank you! After some research I discovered that if you catch the CTLCOLORSTATIC message, you can change the readonly background color too!
So, if you add something like this to the EditControl:
CTLCOLORSTATIC(wParam)
{
if .textcolor isnt ""
SetTextColor(wParam, .textcolor)
SetBkColor(wParam, .color)
return .brush
}SetBgndColor(…) will change the background even if the control is read-only! 🙂
Now my problem is that if you use that code, then the readonly background color will always be the same of the not-readonly window…
gmauro
ParticipantHi Andrew, the 110713 snapshot works, but there is a little problem. Being that I use my old code and old stdlib with the new exe (with a “Suneido.SwitchUnhandledThrow = false” line inserted in the Init function) it appears to work all except a little thing: let’s suppose I go in the menu “Help -> About Suneido”… Now, if I click on the scrollbar of the contributors list, there will be an “unhandled switch value” exception… Why Suneido give to me this exception, even though I have used the SwitchUnhandledThrow flag in the Init function? Maybe because the ScrollControl is loaded before the Init function?
gmauro
ParticipantThanks, I will try this new version. Sorry for the late reply, but the sourceforge forum, sometimes is very very slow or inaccessible to me.
gmauro
ParticipantYes I agree that changes sometimes are necessary and I appreciate all the efforts you make in Suneido development. But for now I have to make sure that my application is stable enough.
I think You are right: a command line option to disable the things that could break old code would be very useful to help the migration.
The new switch/behaviour breaks too many things in my application…
P.S.: the parenthesis thing breaks many things too, being that I rarely use them in the expressions of the “if” statement…gmauro
ParticipantThank you for the snapshot but there are some problems… I will explain them in the Announcements section of the forum, in the thread of the snapshot: link.
gmauro
ParticipantHi Andrew, thank you very much for the snapshot, but unfortunately your new exe breaks too many things in my application code.
For example:
with the old suneido.exe (build Oct 21 2007) I could do:
if a is true { return }
but with the new exe it generates an error unless I do:
if (a is true) { return }
and this is very strange, because in the Suneido syntax, the parenthesis should not be mandatory in the expression of the ‘if’ statement.
Another annoyance is the new switch/case behaviour. Let’s suppose that ‘x = 4’. Before, I could do:
switch(x)
{
case 1:
case 2:
case 3:
}but now it generates an exception unless I add a default:
switch(x)
{
case 1:
case 2:
case 3:
default:
}Maybe this is the correct behaviour for a switch/case statement, but it’s very sad when a new language version breaks old code… For now I stick to the 2007 exe.
gmauro
ParticipantHi Andrew, if you could post a snapshot with the bug fixed it would be very nice. Thanks!
gmauro
ParticipantHi, have you checked that the ‘suneidolog’ table exists?
In the QueryView, enter:
suneidolog
then press F9 and see the result. If you have errors, then I think your ‘suneido.db’ file could be damaged or you have messed up with the system tables. Try to reinstall Suneido and see if it helps.
gmauro
ParticipantIf I run with Wine your “dvcore.exe”, then if I write in the workspace something very simple, like:
Window(#(Horz (Static “Hello”)))
and then I press F9 to execute this line of code, nothing happens… The workspace flashes for an instant, then… nothing!
gmauro
ParticipantHi, I have tried your Suneido on Ubuntu Linux with Wine 1.3.21 (latest development version) but it doesn’t work very well and it’s not much usable (and I don’t know why but it’s very slow).
Anyway, what have you done to Suneido sources to make it work (a little, at least) with Wine? I noticed that there is a new library… It is necessary to make Suneido work with Wine?
gmauro
ParticipantIt’s great! Now, if only we could have a working client in Linux we could get rid of Windows… Why Suneido doesn’t work with Wine? It’s the garbage collector that generates problems? If at least the “Client/GUI interface” worked in Linux/Wine we could use jSuneido as server and Wine/Suneido as client…
gmauro
ParticipantThankyou for your answer. Unfortunately, the definition of a new field with duplicated upper-case versions of the original field will waste space in the database, and I think could be problems with IdControl because this requires a key field for the searching and sorting column…
-
AuthorPosts