MullinRJ Posted June 2, 2020 Share Posted June 2, 2020 Has anyone ever gotten SetColorButton() to work? It is advertised as being introduced in VW 9.0, but I could not get it to affect a color change on a Modern Dialog PushButton in VW 2019, VW2014, or VW 2009, which is as far back as I can test without switching computers. Is it designed to work on a different kind of control? Documentation is sparse in both the HTML Script Function Reference and the online Developer's WIKI. If no one answers to the affirmative in a day I'll file a bug. Thank you, Raymond Quote Link to comment
Julian Carr Posted June 2, 2020 Share Posted June 2, 2020 Yes, in an old PIO. It still works in 2020. Here is the code: Function GetColourIndex(CurrentIndex : INTEGER) : INTEGER; VAR DialogID, DlogResult : INTEGER; Function Define_Dialog: INTEGER; VAR dialogID : INTEGER; BEGIN dialogID := CreateLayout('Choose Colour', False, 'OK', 'Cancel'); CreateGroupBox(dialogID, 4, '', False); CreateControl(dialogID, 5, 2,'',0); SetFirstLayoutItem(dialogID, 4); SetBelowItem(dialogID, 4, 5, 5, 0); Define_Dialog := dialogID; END; Procedure Drive_Dialog(VAR item:LONGINT; data:LONGINT); VAR red, green, blue : LONGINT; BEGIN CASE item OF SetupDialogC: BEGIN ColorIndexToRGB(CurrentIndex, red, green, blue); SetColorButton(DialogID, 5, red, green, blue); END; 1: BEGIN GetColorButton(DialogID, 5, red, green, blue); RGBToColorIndex(red, green, blue, GetColourIndex); END; 2: GetColourIndex := CurrentIndex; END; END; BEGIN DialogID := Define_Dialog; IF VerifyLayout(DialogID) THEN DlogResult := RunLayoutDialog(DialogID, Drive_Dialog); END; Quote Link to comment
MullinRJ Posted June 2, 2020 Author Share Posted June 2, 2020 Hi Julian, That is not what I was hoping for. CreateControl(), option 2, creates a button to select a color from a system color palette. I was hoping to set the color of a PushButton, so I guess I mis-interpreted the function's use. Thank you for clarifying it. Raymond Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.