Page 1 of 1

Extend a Fivewin class

Posted: Sat Jan 25, 2025 11:06 am
by oliveiros junior
Hello everyone, good morning!

I would like to know if it is possible to add a method to an existing class. Ex.: Add the ChangeText method to the TBtnBmp class.

If so, would there be any practical example?

I need to add some information to an object and I would like not to touch the Fivewin classes.

Thank you in advance for everyone's attention.

Oliveiros Junior

Re: Extend a Fivewin class

Posted: Sat Jan 25, 2025 12:36 pm
by nageswaragunupudi
1) Are you using xHarbour or Harbour? Depending on your answer, we will advise you how to add a new method.

2) Please reconsider. It is possible to changetext of BtnBmp using the Existing methods. No need to have any additional method for this. Can you explain what exactly are you looking for.

Re: Extend a Fivewin class

Posted: Sun Jan 26, 2025 2:23 pm
by oliveiros junior
Hello Mr Rao,

I'm using FWH, version 23.07;

My goal is to be able to write various information about the button, different positions.

Ex.:
+------------------------------------------------------------------------------------+
| xxxxxxx ...................................................................... |
| xxxxxxx .......................................XXXXX XXXXXX( image) |
| |
+------------------------------------------------------------------------------------+

I made a multi-button Loop for testing and tried a few things that didn't work using existing methods.

As:

For nX = 1 To Len( oDlg1:aItem )

@ nLinha, nColuna + 50 BTNBMP aBtns[ nX ];
PROMPT "" RIGHT;
FLAT NOBORDER FONT oFontTxt COLOR CLR_BLACK, CLR_WHITE ;
SIZE oDlg1:nLargura - 100, 100 OF oDlg1:oPanel

aBtns[ nX ]:nRound := 20
aBtns[ nX ]:lTransparent := .F.

//aBtns[ nX ]:bPainted := { || aBtns[ nX ]:SayText( 'Linha 1',{ 0, 0, 40, 140 }, 'R', oFontTxt, { CLR_GREEN, CLR_BLACK } ) }

//aBtns[ nX ]:SayText( 'Linha 1',{ 0, 0, 40, 140 }, 'R', oFontTxt, { CLR_GREEN, CLR_BLACK } )

nLinha += 110
Next

Another need I have is to have a wide button with an image aligned to the left and for the action to only be executed if the click occurs on the image.

Thank you in advance for your attention!

Oliveiros Junior