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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

highligh particular cells in grid

Status
Not open for further replies.

sncheong

Programmer
Jan 18, 2001
47
NZ
in my table named Jobs, i have a field called jsts which monitor the status of each job. it has only three options ie pending, approved, rejected. i can display the table in a grid prefectly but i like to have each option highlighted with a bmp picture. i attach a command button in the related column for field jsts and my codes in the init pem of the grid are:-

if thisform.grid1.column1.text1.value='pending'
thisform.grid1.column1.command1.picture='yellow.bmp'
else
if thisform.grid1.column1.text1.value='approved'
thisform.grid1.column1.command1.picture='green.bmp'
else
uf thisform.grid1.column1.text1.value='rejected'
thisform.grid1.column1.command1.picture='red.bmp'
endif
endif
endif

but only grey boxes are displayed. the grid sparse is set to .f. and the command button controlsource is linked to the field jsts and its caption="".

please help. ta

ps i also have a setall with DynamicBackColor for the rows and wonder whether this is affecting the bmp displays.
 
sncheong

Untested but try:-

Add a new form method called .cFileName()

In THISFORM.Grid1.Column1.Init event put :-

DO CASE
CASE THISFORM.grid1.column1.text1.value='pending'
[tab]THISFORM.grid1.column1.command1.picture='yellow.bmp'
CASE THISFORM.grid1.column1.Text1.value='approved'
[tab]THISFORM.grid1.column1.command1.picture='green.bmp'
CASE THISFORM.grid1.column1.Text1.value='rejected'
[tab]THISFORM.grid1.column1.command1.picture='red.bmp'
ENDC

In THISFORM.Grid1.Column1.DynamicCurrentControl put:-

THISFORM.cFileName()

In THISFORM.cFileName put :-

DO CASE
CASE THISFORM.grid1.column1.text1.value='pending'
[tab]THISFORM.grid1.column1.command1.picture='yellow.bmp'
CASE THISFORM.grid1.column1.Text1.value='approved'
[tab]THISFORM.grid1.column1.command1.picture='green.bmp'
CASE THISFORM.grid1.column1.Text1.value='rejected'
[tab]THISFORM.grid1.column1.command1.picture='red.bmp'
ENDC

Set the .Sparse property of THISFORM.Grid1.Column1 to .F.

Chris

 
sorry chris, it didn't work. it displays the command button in its default grey color in each row and the screen flickers too many times, presumably due to the do refresh. can you put on your thinking hat? i'd appreciate that. cheers
 
sncheong

Could you explain why you have embedded cmdButtons in this grid, assuming I have understood your post correctly?

If you click on the cmdButton, what happens?

Chris

 
tks chris

the cmdbutton is in the column and the cmdbutton has a picture to display the status of each job [each record] ie pending, hold or approved. its controlsource is field jsts. this is for job monitoring and management controls the status of the job. its decision is updated via a network to the production area for action. the graphics is also to help manual workers to know what to do next.

no other codes are required to enable the cmdbutton.



 
sncheong

If the embedded cmdButtons do no more than display a bitmap, I suggest you replace the cmdButton with an embedded image control instead.

In the sixth post within Thread184-39989, you will find an example of how display graphical images in a grid using a field containing a filename reference.

This does not answer your original question, but IMHO using a cmdButton only to display a graphical image, is an unnecessary complication.

Chris
 
Hi!

See my answer at the Universal Thread.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top