Suneido

Integrated Application Platform

  • Home
  • Learning
    • Suneido Manual
    • Beginners
      • Inside Suneido
      • The Suneido Programming Language
      • The Suneido Database
      • Installing Suneido
      • Building Suneido
      • IDE Go To Tour
      • Upgrading To A New Release
    • Advanced
      • Canvas Control
      • DrawControl Part 1
      • DrawControl Part 2
      • DrawControl Part 3
      • SAX Like XML Processing
      • A Plug-In Architecture
      • A Simple Wizard Framework
      • An HTML Include Facility
      • An RSS 2 Feed Creator
      • MIME Generation
      • A New Add-on Facility
      • Workspace Improvement Hack
    • Mockito for Suneido
    • The Suneido Task Scheduler
    • Contributing To Suneido
    • Contributor Assignment of Copyright
    • Language Translation
    • Future Directions
    • Interview With Andrew Mckinlay
  • Forum
    • Announcements
    • Internals & Enhancements
    • Cookbook
    • General
  • FAQ
  • Screenshots
  • Downloads
  • Links

Re: Re: Change background color of Editor Control

Integrated Application Platform › Forums › General › Change background color of Editor Control › Re: Re: Change background color of Editor Control

March 6, 2013 at 6:15 pm #969
gmauro
Participant

Yes, 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

Search Forums

Log In
Welcome to the new Suneido Web Site and Forum.
Register
Lost Password
users of the previous PHPBB Forum should be able to log in with their previous username and password.

Recent Topics

  • Alpha copy of gSuneido to play with
  • how to start jsuneido ?
  • Problem Starting Suneido…
  • Dialog not showing buttons
  • New link for Suneidojo

Contact Us | Legal Statement | Privacy Statement | SiteMap

Copyright © 2023 Axon® Development Corporation. All Rights Reserved. - Open Source Integrated Database and Programming Language