COMBOBOX

COMBOBOX

Postby Ruth » Tue Feb 27, 2024 4:09 pm

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 view  RUN
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() )
   
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm

Re: COMBOBOX

Postby karinha » Tue Feb 27, 2024 5:19 pm

Code: Select all  Expand view  RUN

// 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.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: COMBOBOX

Postby Ruth » Tue Feb 27, 2024 5:40 pm

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
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm

Re: COMBOBOX

Postby TimStone » Tue Feb 27, 2024 7:08 pm

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
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: COMBOBOX

Postby Ruth » Wed Feb 28, 2024 8:20 am

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 :oops:
Thanks again for your guidance and support.


Kind regrads
Ruth
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm

Re: COMBOBOX

Postby Euclides » Wed Feb 28, 2024 11:17 am

Hi Ruth.
You can do...
Code: Select all  Expand view  RUN

   REDEFINE COMBOBOX oCbx VAR cItem ... ID 100 ...
   oCbx:SetFont(oFont)
 

Regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm

Re: COMBOBOX

Postby Ruth » Wed Feb 28, 2024 6:49 pm

Dear Euclides,

thank you very much. I tried this too and it worked wonderfully the way you suggested.

Kind regards
Ruth
User avatar
Ruth
 
Posts: 169
Joined: Fri Dec 07, 2007 1:26 pm

Re: COMBOBOX

Postby TimStone » Thu Feb 29, 2024 2:25 am

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
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: MaxP and 85 guests