Page 1 of 1
COMBOBOX
Posted: Tue Feb 27, 2024 4:09 pm
by Ruth
Dear friends,
is it possible to have a COMBOBOX with custom FONT?
I am creating COMBOBOX from resources and get a syntax error when compiling with "FONT oFontBig".
maybe I have to create with source code?
Kind regards to all of you and thank you
Ruth
Code: Select all | Expand
REDEFINE COMBOBOX oCombo VAR cCombo ITEMS { "DANKE", "GUTE ANREISE", "NACHFASSEN Angebot" } ID 4002 OF oDlg FONT oFontBig ON CHANGE;
( cSayTreffer := "", oSayTreffer:refresh() , cSayBeschriftung := aSayBeschriftung[oCombo:nAt], oSayBeschriftung:refresh(),;
f_datumneu( cCombo, dDate1,dDate2,oDlg, oBrw, oBrw2 ),cSayAusgewaehlt:="Abfragezeitraum: "+dtoc(datum) + " bis " + dtoc(datum2), oSayAusgewaehlt:refresh() )
Re: COMBOBOX
Posted: Tue Feb 27, 2024 5:19 pm
by karinha
Code: Select all | Expand
// C:\FWH\SAMPLES\TESTCMB3.PRG
#Include 'FiveWin.ch'
#Include "Constant.ch"
STATIC oBar
FUNCTION Main()
LOCAL oDlg, oDbf, oFont, oBold
LOCAL cOrder := "", oCbx, cTitle
LOCAL nBottom := 27.2
LOCAL nRight := 89
LOCAL nWd := Max( nRight * DLG_CHARPIX_W, 180 )
LOCAL nHt := nBottom * DLG_CHARPIX_H
cTitle := "COMBOBOX by kapiabafwh@gmail.com"
oFont := TFont():New( "Tahoma", 0, 14,, )
oBold := TFont():New( "Tahoma", 0, 32,, .T. )
// DEFINE DIALOG oDlg SIZE nWd, nHt PIXEL TRUEPIXEL TITLE cTitle
DEFINE DIALOG oDlg SIZE 350, 400 PIXEL TRUEPIXEL FONT oFont ;
COLOR CLR_BLACK, RGB( 245, 245, 235 ) TITLE cTitle ;
STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
WS_MINIMIZEBOX)
oDlg:lHelpIcon := .F.
@ 120, 50 COMBOBOX oCbx VAR cOrder SIZE 100, 400 PIXEL OF oDlg ;
ITEMS { "item1", "item2", "item3" } ;
ON CHANGE msgalert( "combobox mudou: " ) ;
HEIGHTGET 36 STYLE CBS_DROPDOWN
SET FONT OF oCbx TO oBold
ACTIVATE DIALOG oDlg CENTER ;
ON INIT ( Btnbar( oBar, oDlg ) )
oFont:End()
oBold:End()
RETURN NIL
FUNCTION Btnbar( oBar, oDlg )
LOCAL aBtnBar
aBtnBar := Array( 6 )
DEFINE BUTTONBAR oBar OF oDlg SIZE 50, 50 TOP NOBORDER 2007
DEFINE BUTTON aBtnBar[ 1 ] OF oBar PROMPT "New" ACTION MsgInfo()
DEFINE BUTTON aBtnBar[ 2 ] OF oBar PROMPT "Modify" ACTION MsgInfo()
DEFINE BUTTON aBtnBar[ 3 ] OF oBar PROMPT "Duplicate" ACTION MsgInfo()
DEFINE BUTTON aBtnBar[ 4 ] OF oBar PROMPT "Del" ACTION MsgInfo()
DEFINE BUTTON aBtnBar[ 5 ] OF oBar PROMPT "Print" ACTION MsgInfo()
DEFINE BUTTON aBtnBar[ 6 ] OF oBar PROMPT "Exit" ACTION( oDlg:End() )
RETURN( oBar )
// FIN / END - kapiabafwg@gmail.com
Regards, saludos.
Re: COMBOBOX
Posted: Tue Feb 27, 2024 5:40 pm
by Ruth
Dear Mr. Santos,
thank you very much -> it is working so nicely and looking really good
Kind regards to all and have a nice evening
Ruth
Re: COMBOBOX
Posted: Tue Feb 27, 2024 7:08 pm
by TimStone
You received an error because REDEFINE COMBOBOX does not support FONT. Check fivewin.ch to always see the latest implementation of a command line.
I use resources exclusively because the alignment on a complex dialog is much easier. I use the following resource to see the latest implementation of RC commands ( syntax ):
https://learn.microsoft.com/en-us/windo ... -resources
Rather than go to the site, I downloaded the pages into OneNote for faster reference, and from there I can click on a command and it will take me to the link.
The RC for COMBOBOX does not have an option to change the font, but you can have differing fonts for each dialog box.
Tim
Re: COMBOBOX
Posted: Wed Feb 28, 2024 8:20 am
by Ruth
Dear Mr. Stone,
thank you very much for the explanation and for pointing me to these great sources of information. I followed the steps and things are starting to get a bit clearer for me already
Thank you all for your patience and sorry for floating the forum with maybe too basic questions
Thanks again for your guidance and support.
Kind regrads
Ruth
Re: COMBOBOX
Posted: Wed Feb 28, 2024 11:17 am
by Euclides
Hi Ruth.
You can do...
Code: Select all | Expand
REDEFINE COMBOBOX oCbx VAR cItem ... ID 100 ...
oCbx:SetFont(oFont)
Regards, Euclides
Re: COMBOBOX
Posted: Wed Feb 28, 2024 6:49 pm
by Ruth
Dear Euclides,
thank you very much. I tried this too and it worked wonderfully the way you suggested.
Kind regards
Ruth
Re: COMBOBOX
Posted: Thu Feb 29, 2024 2:25 am
by TimStone
Ruth,
Often many of us who have done this a long time need to ask questions to "refresh" our thinking on even basic items. It is always fine to ask any questions.
Tim