Paradox Community

Items in comp.databases.paradox

Subject:Re: Dark Theme Option?
Date:Wed, 06 Nov 2019 11:31:24 +0100
From:modridirkac <jure.zorko@gmail.com>
Newsgroups:comp.databases.paradox
> This is going to be a lot of work whichever way I go and I really need  
> to get this right the first time around.

Why?

1. Create library myLib
2. create method ChangeColors in library myLib
3. method:

method ChangeColors(var F Form)
var TC TCursor
	 UI UIobject
     ini string
     maskCol longint
     textCol LongInt
endVar
   ; read settings from INI
	ini = readProfileString(privdir() + "\\colors.ini", "Masks", "Mask color")
    if ini.isSpace() then ini="Gray" endIf
	try
		maskCol = constantNameToValue(ini)
    onFAil
    	maskCol = Gray
    endTry

	ini = readProfileString(privdir() + "\\colors.ini", "Masks", "Text color")
    if ini.isSpace() then ini="Black" endIf
	try
		textCol = constantNameToValue(ini)
    onFAil
    	textCol = Black
    endTry

	F.enumUIObjectNames(":PRIV:__obj")
	TC.Open(":PRIV:__obj")
	scan TC :     ; check every object on Form
		switch
			case TC."ObjectClass" = "Text" :
				try    ; attach to object
					if not UI.Attach(F.(TC."ObjectName")) then loop endIf
				onFail
		  			loop
				endtry
				; change text on object (if you need to translate it)
				;UI.Value = proc_translation(UI.Value)
				; if you need it, change colour and style
				;UI.Font.Style = FontAttribBold ; FontAttribItalic, FontAttribNormal,  
FontAttribStrikeout, FontAttribUnderline
				;UI.Font.TypeFace = "Arial"
				UI.Font.Color = textCol
			case TC."ObjectClass"="Record" or TC."ObjectClass"="Multirecord" or  
TC."ObjectClass"="Page" or TC."ObjectClass"="FormData" or  
TC."ObjectClass"="NotePage" or TC."ObjectClass"="Box" or  
TC."ObjectClass"="TableFrame":
			     if not UI.Attach(F.(TC."ObjectName")) then loop endIf
               UI.Color = maskCol
		endSwitch
	endScan
endMethod


4. in INIT method of all forms you would like to change:

uses ObjectPAL
	ChangeColours(var F Form)
endUses

method init(var eventInfo Event)
var l library
	 F Form
endVar
	doDefault
	F.Attach()
	 l.open("mylib")
	 l.ChangeColors(F)
endMethod


5. Write different colors in INI file and test.


Copyright © 2004 thedbcommunity.com