Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LostFocus for the header control
Message
From
14/09/2001 10:43:38
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00556206
Message ID:
00556469
Views:
18
Hi!

I know this is a problem. I have a property in the Header class that I pre-fill at the grid.Init by scanning all columns.

You can also just scan columns in grid.columns array until column.ColumnOrder = this.parent.ColumnOrder.


>Vlad,
>
>There is no propety ColumnIndex for column. And the ColumnOrder is not reliable. How can I determine the column index?
>
>>Hi!
>>
>>>>>Besided, I can click on text in another column in a grid, and the header would not change color
>>
>>Nadya, why you need this, in other words, what is use-case of such coloring? Just AfterRowColChange event.
>>
>>About SetAll and about remembering of the column index I already mentioned in your previous thread.
>>
>>Also, to make it generic, I would like to add that you cand define a method in the header class called "Highlight" or something like that. This method will control the index of current highlighted column in the GRID class. You will be able to call it from any place in the grid include from the AfterRowColChange. In the method you will read previous index from grid property, if it is not zero (no column highlighted) - restore back color, then set back color of the "this" header and set column index to the current column index (either using loop or using saved index in the header in separate property for each column). About RestoreToDefault, it is also not a good idea to use it in case you predict back color could be changed by programmer in run-time mode. It is good idea to define Header.BackColor_Assign method where you store the color change in the OriginalBackColor and check - if this column is highlighted, do not change BackColor. When restoring color, instead of ResetToDefault
>copy
>>the value from the OriginalBackColor to restore header color. In the Init, of course, set initial value of the Original BackColor property.
>>
>>HTH.
>>
>>P.S. I did passed the time such grid developed, so you can ask also for more complex questions. For example, instead of header coloring, put arrow to indicate sorted column and the direction of sorting.
>>
>>>>Putting this in the MouseMouve of each header works for me:
>>>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>>>local lnI
>>>>for lnI = 1 to This.Parent.Parent.ColumnCount
>>>>    This.Parent.Parent.Columns(lnI).Header1.ForeColor = rgb(0,0,0)
>>>>endfor
>>>>This.ForeColor = rgb(200,0,0)
>>>>
>>>
>>>Thanks, Mark. As I thought about this problem on the way home, there are couple of complications. First of all, I want to restore color, which may be not necessary black. Secondly, I thought, that I should leave red color on the column, which is ordered until the other column is re-ordered. Third complication is, that I have ability to change order by some other form control, and I want to change color accordingly. I was trying to work out a solution in my mind, but haven't developed anything general and simple so far.
>>>
>>>
>>>>>Hi everybody,
>>>>>
>>>>>How can I determine, that the current Header is loosing focus? In other words, suppose, I click on the Header on the grid and change its color. When I click on another column header, I want to reset previously current Header color to the original color, and change color of the currently clicked Header?
>>>>>
>>>>>Do you have an idea, how can I achieve this functionality?
>>>>>I tried this.parent.parent.SetAll(..) from the click event of the Header, but it's not exactly, what I want. Besided, I can click on text in another column in a grid, and the header would not change color :(
>>>>>
>>>>>Thanks a lot in advance for ideas.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform