In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.
'Screen Prompt' class based on TLabel ....
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
'Screen Prompt' class based on TLabel ....
I am attempting to make a 'Screen Prompt' class which responds to mouse clicks and key presses including ALT+Key combinations.
It is based on a TLabel for its onclick event and I am using Form:FormKeyDown() and WMSysKeyDown() to detect the ALT key .... my prototype enhanced label is basically working, see below.
In our [x]Harbour applications we have similar 'Screen Prompts' class and we are show the keyboard letter/letters in a different colour, see below
I would like to do the same thing with the text on my enhanced TLabel.
My plan at the moment is to display the whole text in the default colour and then try to overwrite a part of the string in the 'Action' colour.
This is where I get stuck!!
How to place some coloured text over a small section of the main text ..... to make it worse the action colour letters are not always at the beginning of the prompt.
Any thoughts on whether this is possible and how to start doing it would be appreciated.
Thank you.
Chris
It is based on a TLabel for its onclick event and I am using Form:FormKeyDown() and WMSysKeyDown() to detect the ALT key .... my prototype enhanced label is basically working, see below.
In our [x]Harbour applications we have similar 'Screen Prompts' class and we are show the keyboard letter/letters in a different colour, see below
I would like to do the same thing with the text on my enhanced TLabel.
My plan at the moment is to display the whole text in the default colour and then try to overwrite a part of the string in the 'Action' colour.
This is where I get stuck!!
How to place some coloured text over a small section of the main text ..... to make it worse the action colour letters are not always at the beginning of the prompt.
Any thoughts on whether this is possible and how to start doing it would be appreciated.
Thank you.
Chris
- ignacio
- Site Admin
- Mensajes: 9254
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: 'Screen Prompt' class based on TLabel ....
Hello Chris,
Maybe I'm missing something, but it seems you can use a TLabelEx control in conjuntion with its OnLinkClick event.
Regards,
Maybe I'm missing something, but it seems you can use a TLabelEx control in conjuntion with its OnLinkClick event.
Regards,
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Re: 'Screen Prompt' class based on TLabel ....
Hi Ignacio,
Thanks for your thoughts on this one.
I have had a go with TlabelEx and the basic HTML ability gives me the exact style I am looking for with the highlighted letter/s within the label .... example 2.
If I use <a><a/> to achieve an action link then I may struggle to get the colours I want and I did try ..... example 1.
The big problem with <a></a> is that it only gives me the click action on the highlighted letters ... as you would expect.
My wish is to have the whole region of the control clickable with a simple onClick() event but this does not appear to work, although it is in the property editor of the IDE.
Example 2 is the visual I want but with the whole region of the control clickable ... is there any chance of that?
This style of 'mouse and keyboard aware' prompt or button would allow us to consider migrating our major systems to a 21st century GUI using Xailer .... it is very important to me to give my business systems a future.
Any help would be appreciated.
Thanks
Chris
My simple test code is attached
Thanks for your thoughts on this one.
I have had a go with TlabelEx and the basic HTML ability gives me the exact style I am looking for with the highlighted letter/s within the label .... example 2.
If I use <a><a/> to achieve an action link then I may struggle to get the colours I want and I did try ..... example 1.
The big problem with <a></a> is that it only gives me the click action on the highlighted letters ... as you would expect.
My wish is to have the whole region of the control clickable with a simple onClick() event but this does not appear to work, although it is in the property editor of the IDE.
Example 2 is the visual I want but with the whole region of the control clickable ... is there any chance of that?
This style of 'mouse and keyboard aware' prompt or button would allow us to consider migrating our major systems to a 21st century GUI using Xailer .... it is very important to me to give my business systems a future.
Any help would be appreciated.
Thanks
Chris
My simple test code is attached
- Adjuntos
-
- 2016-09-11_14-10-17_2.jpg (77.93 KiB) Visto 7824 veces
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Re: 'Screen Prompt' class based on TLabel ....
Just to summarise ....
Seems what I really want is a TBtnEx inherited from TButton, but with the html text ability of TLabelEx.
A bit like the TBtnBmp ..... without the Bmp but with enhanced text from the html ability of TLabelEx to style the text, would not need the <a></a> ).
With some option for having the text 'centred' within the button.
But thats all well beyond my capability!!
Thats my ideal, just a thought.
Chris
Seems what I really want is a TBtnEx inherited from TButton, but with the html text ability of TLabelEx.
A bit like the TBtnBmp ..... without the Bmp but with enhanced text from the html ability of TLabelEx to style the text, would not need the <a></a> ).
With some option for having the text 'centred' within the button.
But thats all well beyond my capability!!
Thats my ideal, just a thought.
Chris
- ignacio
- Site Admin
- Mensajes: 9254
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: 'Screen Prompt' class based on TLabel ....
Hello,
TLabelEx OnClick can be fixed with this two lines:
HB_FUNC_STATIC( XLABELEX_WMLBUTTONDOWN )
{
..............
..............
>>>> if( !bRet )
>>>> XA_ObjSendNL2( Self, "OnClick", pt.x, pt.y );
hb_xfree( aLink );
..............
..............
}
If you need the OBJ,0 files just let me know.
I include with this message a small project that may give you some clue. I hope so.
Regards,
TLabelEx OnClick can be fixed with this two lines:
HB_FUNC_STATIC( XLABELEX_WMLBUTTONDOWN )
{
..............
..............
>>>> if( !bRet )
>>>> XA_ObjSendNL2( Self, "OnClick", pt.x, pt.y );
hb_xfree( aLink );
..............
..............
}
If you need the OBJ,0 files just let me know.
I include with this message a small project that may give you some clue. I hope so.
Regards,
- Adjuntos
-
- screenprompt.zip
- (2.59 KiB) Descargado 202 veces
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Re: 'Screen Prompt' class based on TLabel ....
Hi Ignacio,
Thank you for that fix .... it is almost perfect.
In the first example it works fine and gives me an OnClick event for the whole surface of the button.
With example 2 .... with no html link defined with <a></a> .... the code bypasses your new OnClick fix.
Something to do with it being in the 'if nCount' structure.
Can your fix be placed outside that if?
A code sample is always good for me.
Thanks
Chris
Thank you for that fix .... it is almost perfect.
In the first example it works fine and gives me an OnClick event for the whole surface of the button.
With example 2 .... with no html link defined with <a></a> .... the code bypasses your new OnClick fix.
Something to do with it being in the 'if nCount' structure.
Can your fix be placed outside that if?
A code sample is always good for me.
Thanks
Chris
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Re: 'Screen Prompt' class based on TLabel ....
Hi Ignacio,
I had not run your example project .... thats very much how I want this to look when it is finished.
Thinking about whether onclick needs to work even when there is no <a></a> defined ... In looking at your example I'm fairly happy to have the underline if you think it should work that way.
A great example project, which gives me a good lesson in Xailer programming.
Thank you.
Chris
I had not run your example project .... thats very much how I want this to look when it is finished.
Thinking about whether onclick needs to work even when there is no <a></a> defined ... In looking at your example I'm fairly happy to have the underline if you think it should work that way.
A great example project, which gives me a good lesson in Xailer programming.
Thank you.
Chris
- ignacio
- Site Admin
- Mensajes: 9254
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: 'Screen Prompt' class based on TLabel ....
Código: Seleccionar todo
HB_FUNC_STATIC( XLABELEX_WMLBUTTONDOWN )
{
PHB_ITEM Self = hb_stackSelfItem(), tControl;
HWND hWnd = GetHandleOf( Self );
int wParam = hb_parnl( 1 ), lParam = hb_parnl( 2 );
int bRet = FALSE;
HDC hdc = CreateCompatibleDC( NULL );
POINT pt;
UINT nTextLen = 0;
char *cText = XA_ObjGetCLen( Self, "cText", &nTextLen );
int nLineSpacing = XA_ObjGetNL( Self, "nLineSpacing" ) & 1023;
DT_LINK *aLink;
int nCount = 0, n;
RECT rect;
if( XA_ObjGetL( Self, "lTabStop" ) )
SetFocus( hWnd );
GetClientRect( hWnd, &rect );
XA_DrawTextEx( hdc, cText, nTextLen, &rect, DT_CALCRECT | nLineSpacing, 0, NULL, &nCount );
if( nCount )
{
pt.x = LOWORD( lParam );
pt.y = HIWORD( lParam );
SelectObject( hdc, GetHandleOf( XA_ObjGetItem( Self, "GetFont" ) ) );
aLink = hb_xgrab( sizeof( DT_LINK ) * nCount );
XA_DrawTextEx( hdc, cText, nTextLen, &rect, DT_CALCRECT | nLineSpacing, 0, aLink, &nCount );
pt.y -= XA_ObjGetNL( Self, "nClientTop" );
for( n = 0; n < nCount; n++ )
{
if( PtInRect( &aLink[ n ].rect, pt ) )
{
cText = hb_xgrab( aLink[ n ].nTextLen + 1 );
strncpy( cText, aLink[ n ].cText, aLink[ n ].nTextLen );
cText[ aLink[ n ].nTextLen ] = 0;
XA_ObjSendC( Self, "OnLinkClick", cText );
hb_xfree( cText );
bRet = TRUE;
break;
}
}
hb_xfree( aLink );
}
DeleteDC( hdc );
if( !bRet )
{
tControl = XA_ObjGetItemCopy( Self, "TControl" );
XA_ObjSendNL2( tControl, "WMSetCursor", wParam, lParam );
hb_itemRelease( tControl );
XA_ObjSendNL2( Self, "OnClick", pt.x, pt.y );
}
}
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Re: 'Screen Prompt' class based on TLabel ....
Hi Ignacio,
That last piece of code seems to fifish the job off.
It gets us started on a replacement GUI for our traditional applications, its going to take many months and up to a year to get something a customer can use but we have to start.
Thanks for your help
Chris
That last piece of code seems to fifish the job off.
It gets us started on a replacement GUI for our traditional applications, its going to take many months and up to a year to get something a customer can use but we have to start.
Thanks for your help
Chris
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Re: 'Screen Prompt' class based on TLabel ....
Hi Ignacio,
Just a post to show progress on my ScreenPrompt and menus classes and request one improvement to TLabelEx maybe.
My request is more control the alignment of the text in the TLabelEx control to improve the appearance.
For the titles I might like a CENTER option, standard would be LEFT and maybe also useful RIGHT. This could be achieved as a Property or maybe within the text itself with some pseudo HTML?
It would also be useful to be able to move the text a number of pixels in from the left side of the Prompts to give some space there. This could be a 'Margin' or 'Indent' Property or maybe within the text itself with some pseudo HTML?
Anyway, it is certainly usable at the moment.
Thank you for your help.
Chris
Just a post to show progress on my ScreenPrompt and menus classes and request one improvement to TLabelEx maybe.
My request is more control the alignment of the text in the TLabelEx control to improve the appearance.
For the titles I might like a CENTER option, standard would be LEFT and maybe also useful RIGHT. This could be achieved as a Property or maybe within the text itself with some pseudo HTML?
It would also be useful to be able to move the text a number of pixels in from the left side of the Prompts to give some space there. This could be a 'Margin' or 'Indent' Property or maybe within the text itself with some pseudo HTML?
Anyway, it is certainly usable at the moment.
Thank you for your help.
Chris
- ignacio
- Site Admin
- Mensajes: 9254
- Registrado: Lun Abr 06, 2015 8:00 pm
- Ubicación: Madrid, Spain
- Contactar:
Re: 'Screen Prompt' class based on TLabel ....
Hello Chris,
>>My request is more control the alignment of the text in the TLabelEx control to improve the appearance.
I'm afraid that functionality is not available on TLabelEx, sorry. BTW in order to add a margin to all the card box elements you can use the property nCardMargin.
Regards,
>>My request is more control the alignment of the text in the TLabelEx control to improve the appearance.
I'm afraid that functionality is not available on TLabelEx, sorry. BTW in order to add a margin to all the card box elements you can use the property nCardMargin.
Regards,
-
- Mensajes: 384
- Registrado: Mar May 01, 2007 5:49 pm
Re: 'Screen Prompt' class based on TLabel ....
Hi Ignacio,
Sounds like a move to CardBox class may be the way to go with Xailer 5.
Thank you for your help with these menus ... they are usable and I will move on to the next building blocks I need.
Chris
Sounds like a move to CardBox class may be the way to go with Xailer 5.
Thank you for your help with these menus ... they are usable and I will move on to the next building blocks I need.
Chris