Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BackColor in Listview Control

Status
Not open for further replies.

154868

Programmer
Dec 5, 2003
23
Hi,

Could anyone advise how to change the .BackColor Property in the MS Listview Control ?
I get always a OLE-Error!

Andreas

Andreas Wichmann
DataBit GmbH
Switzerland
 
Some Activex have to be handled differently than the base controls of VFP. You can set the backcolor property of the ListView in the Init of the form. Copy the following in a program and run it to see an example.
Code:
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT olecontrol1 AS olecontrol WITH ;
		Top = 24, ;
		Left = 48, ;
		Height = 181, ;
		Width = 253, ;
		Name = "Olecontrol1",;
		OleClass = "MSComctllib.ListviewCtrl.2"
	PROCEDURE Init
		[b]this.olecontrol1.backColor = RGB(255,128,128)[/b]
	ENDPROC
ENDDEFINE


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,

sorry, I mean the property of a item (loItem.BACKCOLOR).
the Property FORECOLOR works very well.

Andreas

Andreas Wichmann
DataBit GmbH
Switzerland
 
154868

This might be an option (I posted this a year ago)
Code:
PUBLIC oform1
oform1=CREATEOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
    Top = 0
    Left = 0
    Height = 238
    Width = 468
    DoCreate = .T.
    Caption = "Form1"
    Name = "Form1"
   ADD OBJECT list1 AS listbox WITH ;
        RowSourceType = 9, ;
        RowSource = "P_list", ;
        Height = 181, ;
        Left = 60, ;
        Top = 24, ;
        Width = 265, ;
        Name = "List1"
    PROCEDURE Load
        PUBLIC P_list
        DEFINE POPUP P_list
        DEFINE BAR 1 OF P_LIST ;
          PROMPT "Item number 1 of the list";
          FONT "Tahoma",14 style "BI";
          COLOR , RGB(255,255,255,192,0,0)
        DEFINE BAR 2 OF P_LIST ;
          PROMPT "Item number 2 of the list";
          FONT "Tahoma",11 style "B"
        DEFINE BAR 3 OF P_LIST ;
          PROMPT "Item number 3 of the list";
          FONT "Arial",9 style "B";
           COLOR , RGB(255,255,255,192,255,0)
    ENDPROC
ENDDEFINE


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top