Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create and populate drop-down list inside a cell #104

Closed
nmossvfp opened this issue Dec 22, 2023 · 12 comments
Closed

Create and populate drop-down list inside a cell #104

nmossvfp opened this issue Dec 22, 2023 · 12 comments

Comments

@nmossvfp
Copy link

Hi Greg,

Can you please tell me how to create a drop-down list inside of a specific cell?
Let's say it would be just "Yes" or "No" and not editable just selectable with the mouse like any list drop-down.

In addition to a specific cell by specifying the page (row, column) how could I create one for an entire column where the same drop-down choices would show in every row except for the header line?

@ggreen86
Copy link
Owner

ggreen86 commented Dec 22, 2023 via email

@ggreen86
Copy link
Owner

ggreen86 commented Dec 22, 2023 via email

@nmossvfp
Copy link
Author

Thanks! I was able to use setcellvalidation() to create the columns I need and the drop choices do appear however...

  1. I don't see in the examples a way to specify a conditional formatting request based on the user's selection made. For example, to change the cell to Red background when the focus is lost if 'No' was selected from the drop-down or Green background if 'Yes' was selected. Similar to how an IIF in a VFP grid Dynamic backcolor works.

  2. I have a .SETCELLFONT command which already changes the column values to Arial 12 for my Yes/No column. This causes the Yes, No options in the drop-down when selected to appear in a much smaller font than the row contents it looks like Arial 9 or smaller. I don't see where to apply a Font and/or Font size parameter in .Setcellvalidation() Is there one?

I will continue to look through the DEMO method code. It's possible the answers are there i am just unfamiliar with it.

@ggreen86
Copy link
Owner

ggreen86 commented Dec 22, 2023 via email

@ggreen86
Copy link
Owner

ggreen86 commented Dec 22, 2023 via email

@nmossvfp
Copy link
Author

There is example code in the demo method for setting based on the dynamic cell values. >>>

I am looking through the Demo() code thoroughly and unless I am just missing it ? can you please tell me how I would add conditional formatting to any cell even one at a time?

I know that I can change the Font and Background color of a cell with the following:
this.SetCellFont(lnWb, lnSh2, 1, 1, "Arial", 14, True, False, RGB(255,255,255))
this.SetCellFill(lnWb, lnSh2, 1, 1, RGB(51,102,255))

But in Excel I can specify a user defined conditional background color based on data entry. So for example if someone enters "Yes" and Tabs out the back color becomes Green and if they enter "No" the back color becomes Red etc. In VFP this would be backcolor=IIF(myentry="Yes", RGB(0,255,0), RGB(255,0,0)) simplified for 'No' as an otherwise.

Can I do that ?

@ggreen86
Copy link
Owner

ggreen86 commented Dec 26, 2023 via email

@nmossvfp
Copy link
Author

Just to clarify with steps the feature that I am looking for it is called Conditional Formatting. This adds a formatting condition such as a colored background to an otherwise blank cell that an Excel user will populate at a later time.

  1. Click on a cell for which you want to apply conditional formatting.

  2. On the main toolbar click “Conditional Formatting” and from the drop-down select “Highlight Cells Rules” and from the next drop-down select “Equal To”.

  3. On the “Equal To” dialog, enter a text condition such as “Yes” and then select an associated color from the “with” list such as “Green Fill…” etc. Click the OK button.

  4. The conditional formatting is applied and when the condition is met for that cell, example a user types “Yes” then the background color turns Green.

Is this supported ?

Thank You.

@ggreen86
Copy link
Owner

ggreen86 commented Jan 10, 2024 via email

@nmossvfp
Copy link
Author

the section “Methods – Conditional Formatting” (page 71)<<<

I found this in the Release 39 documentation but I am a few releases behind. Was it introduced in Release 39?

@ggreen86
Copy link
Owner

ggreen86 commented Jan 10, 2024 via email

@ggreen86
Copy link
Owner

Closing issue. Conditional formatting provided in R40 onward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants