SelFont
- Enrico Maria Giordano
- Posts: 8770
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 7 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42662
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 69 times
- Been thanked: 96 times
- Contact:
- Enrico Maria Giordano
- Posts: 8770
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 7 times
- Contact:
- Otto
- Posts: 6416
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 35 times
- Been thanked: 2 times
- Contact:
Hello Enrico,
thank you for your answer. But I can't find a way how to do.
1) DEFINE FONT oFontTest NAME "MS Sans Serif" SIZE -7.04,-16
and the color should be black.
2) I use oLbxX:SelFont() and would like to save the values
oLbxX:oFont:cFaceName () …
and also the chosen color. How to get the color?
Maybe you have a code example.
Regards
Otto
thank you for your answer. But I can't find a way how to do.
1) DEFINE FONT oFontTest NAME "MS Sans Serif" SIZE -7.04,-16
and the color should be black.
2) I use oLbxX:SelFont() and would like to save the values
oLbxX:oFont:cFaceName () …
and also the chosen color. How to get the color?
Maybe you have a code example.
Regards
Otto
- Enrico Maria Giordano
- Posts: 8770
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 7 times
- Contact:
- Antonio Linares
- Site Admin
- Posts: 42662
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 69 times
- Been thanked: 96 times
- Contact:
Hello Oto,
Try this:
Regards,
Rossine.
Try this:
Code: Select all | Expand
// Browsing arrays using TWBrowse
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local oDlg, oBrw
local aSample := { { "First row one", "First row two" },;
{ "Second row one", "Second row two" },;
{ "Third row one", "Third row two" },;
{ "Fourth row one", "Fourth row two" } }
SET _3DLOOK ON
DEFINE DIALOG oDlg FROM 2, 2 TO 20, 60 TITLE "right click on the listbox"
@ 1, 2 LISTBOX oBrw ;
FIELDS "", "" ;
HEADERS "Reviewing two dimensions", "Array" ;
FIELDSIZES 150, 150 ;
OF oDlg ;
SIZE 150, 100 ;
ON DBLCLICK MsgInfo( "Array row: " + Str( oBrw:nAt ) + CRLF + ;
"Array col: " + Str( oBrw:nAtCol( nCol ) ) )
// bLine is a codeblock that returns an array
// if you need a 'traditional column based browse' have a look at TcBrowse
oBrw:nAt = 1
oBrw:bLine = { || { aSample[ oBrw:nAt ][ 1 ], aSample[ oBrw:nAt ][ 2 ] } }
oBrw:bGoTop = { || oBrw:nAt := 1 }
oBrw:bGoBottom = { || oBrw:nAt := Eval( oBrw:bLogicLen ) }
oBrw:bSkip = { | nWant, nOld | nOld := oBrw:nAt, oBrw:nAt += nWant,;
oBrw:nAt := Max( 1, Min( oBrw:nAt, Eval( oBrw:bLogicLen ) ) ),;
oBrw:nAt - nOld }
oBrw:bLogicLen = { || Len( aSample ) }
oBrw:cAlias = "Array" // Just put something
oBrw:brclicked := { |row,col| TROCA_FONT( oBrw ) }
@ 1, 30 BUTTON "&End" OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
return nil
*******************
function TROCA_FONT( oBrw )
*******************
local oObj
oBrw:GetFont()
oBrw:SelFont()
oBrw:setcolor( oBrw:nClrText, choosecolor(oBrw:nClrPane) )
oBrw:refresh()
return NIL
Regards,
Rossine.
- Enrico Maria Giordano
- Posts: 8770
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 7 times
- Contact:
- Otto
- Posts: 6416
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 35 times
- Been thanked: 2 times
- Contact:
Hello Enrico,
adesso ti spiego ...
I do have a button where the user can change the font of the browser on the fly.
oLbxX:SelFont() does the job.
but then the new selection should become the new default setup.
Therefore I have to store all the values. If you start your program next time all your changes are still there.
Regards
Otto
adesso ti spiego ...
I do have a button where the user can change the font of the browser on the fly.
oLbxX:SelFont() does the job.
but then the new selection should become the new default setup.
Therefore I have to store all the values. If you start your program next time all your changes are still there.
Regards
Otto
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Otto,
Here is the selFont() method from TWindow:
TWBrowse inherts from TControl which inherits from TWindow, so this is the same method in TWBrowse.
You can see that ::nClrText is the font color. So oLbx:nClrText holds the RGB value of the font color.
James
Here is the selFont() method from TWindow:
Code: Select all | Expand
METHOD SelFont() BLOCK { | Self, nClr | nClr := ::nClrText,;
::SetFont( If( ::oFont == nil,;
TFont():New( ,,,.t. ),;
::oFont:Choose( @nClr ) ) ),;
::oFont:nCount--,;
::nClrText := nClr, ::Refresh() }
TWBrowse inherts from TControl which inherits from TWindow, so this is the same method in TWBrowse.
You can see that ::nClrText is the font color. So oLbx:nClrText holds the RGB value of the font color.
James