FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour modern flat screen dark mode
Posts: 38
Joined: Thu Aug 04, 2022 12:45 PM
modern flat screen dark mode
Posted: Fri May 30, 2025 11:48 AM

does anyone have a simple example of using real dark mode and flatter, more 'modern' screens like Windows 11 without using the http?

thanks

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: modern flat screen dark mode
Posted: Fri May 30, 2025 01:57 PM
From FWH\samples\agentdoc2.prg
#include "FiveWin.ch"

static aFiles, aInfo, oBrw, cPrompt, oChat

function Main()

    local oFont, oWnd, oBar, oBtn, oMsgBar

    // oChat = TOpenAI():New()
    aInfo = Array( 10, 4 )

    DEFINE FONT oFont SIZE 0, -25 NAME "system-ui"

    SetDarkTheme()

    cPrompt = "document this code, explaining what this Class is about," + ;
              " listing all the DATAs and METHODs," + ;
              " and providing a brief description of each of them. Code: "

    DEFINE WINDOW oWnd TITLE "Agent AI" SIZE 1395, 866

    DEFINE BUTTONBAR oBar OF oWnd 2010 SIZE 70, 70 LEFT 

    DEFINE BUTTON OF oBar FILE 0xE1D3 TOOLTIP "Database" ACTION MariaConnect() 

    DEFINE BUTTON OF oBar FILE 0xE9E9 TOOLTIP "Settings"

    DEFINE BUTTON OF oBar FILE 0xE9F5 ACTION GetFileNames() TOOLTIP "Context"

    DEFINE BUTTON OF oBar FILE 0xE11B ACTION FW_memoEdit( @cPrompt, "Prompt" ) TOOLTIP "Prompt"

    DEFINE BUTTON OF oBar FILE 0xE102 ACTION QueryAI() TOOLTIP "Ask AI"

    DEFINE BUTTON OF oBar FILE 0xE9A6 TOOLTIP "View" ACTION SourceEdit( oBrw:aRow[ 2 ] )

    DEFINE BUTTON OF oBar FILE 0xE8C8 ACTION FW_CopyToClipboard( oBrw:aRow[ 2 ] ) TOOLTIP "Copy to clipboard"

    oBar:SetDarkTheme()

    @ 0, 0 XBROWSE oBrw OF oWnd LINES FONT oFont ;
        AUTOCOLS DATASOURCE aInfo AUTOSORT FOOTERS NOBORDER FASTEDIT ;
        ON CHANGE ( oMsgBar:cMsgDef := "Size: " + ;
                    Transform( aInfo[ oBrw:nArrayAt ][ 4 ], "999,999" + " bytes" ), oMsgBar:Refresh() )

    oBrw:cHeaders      = { "Source", "Docs", "Instructions", "Filesize" }
    oBrw:nWidths       = 300
    oBrw:nDataLines    = 6
    oBrw:nMarqueeStyle = MARQSTYLE_HIGHLCELL
    oBrw:aCols[ 4 ]:cEditPicture = "999,999"
    oBrw:RecSelShowRecNo()
    oBrw:SetDarkTheme()
    oBrw:CreateFromCode()

    oWnd:oClient = oBrw

    DEFINE MSGBAR oMsgBar OF oWnd NOINSET NOBORDER FONT oFont
    oMsgBar:SetDarkTheme()

    ACTIVATE WINDOW oWnd CENTER

    oFont:End()

return nil    

function GetFileNames()

    local aFile 

    aFiles = Directory( "c:\fwteam\source\classes\*.prg" )
    aInfo = {}

    for each aFile in aFiles
       AAdd( aInfo, { aFile[ 1 ], "", "", aFile[ 2 ] } )
    next

    oBrw:SetArray( aInfo )
    
return nil    

function QueryAI()

    MsgRun( "asking AI", "please wait...",;
            { || oChat:Send( cPrompt + memoRead( "c:\fwteam\source\classes\" + oBrw:aRow[ 1 ] ) ) } ) 
    oBrw:aRow[ 2 ] = oChat:GetValue()
    oBrw:RefreshCurrent()

return nil    

function MariaConnect()

   local cServer := Space( 15 ), cDatabase := Space( 15 ), cUserName := Space( 15 ), cPassword := Space( 15 )

   EDITVARS cServer, cDatabase, cUserName, cPassword TITLE "Server login"

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM
Re: modern flat screen dark mode
Posted: Fri May 30, 2025 02:15 PM
// C:\FWH..\SAMPLES\MENUBLAC.PRG - Version: 02

#Include "Fivewin.ch"

REQUEST HB_LANG_PT
REQUEST HB_CODEPAGE_PT850

ANNOUNCE RDDSYS // IDEM: ANNOUNCE FPTCDX
REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto // Para ListBox
REQUEST DBFCDX, DBFFPT

STATIC oWnd, oFont, oFontMenu

FUNCTION Main()

   MyWindow()

RETURN NIL

FUNCTION MyWindow()

   LOCAL oBar, oBtn1, oBtn2, oBtn3, oBtn4, oBtn5, oBtn6, oBtn7, oBtn8, oBmp
   LOCAL oMsgItem, oMsgItemMail, cTitle

   HB_GCALL( .F. ) // PARA LIMPAR A MEMORIA .F. -> Somente se tiver lixo.

   HB_LANGSELECT( 'PT' )     // Default language is now Portuguese
   HB_SETCODEPAGE( "PT850" )
   HB_CDPSELECT( "PTISO" )

   RDDSETDEFAULT("DBFCDX")
   RDDREGISTER( "DBFCDX", 1 ) // RDT_FULL -> 20/10/2022 Joao

   SET CENTURY ON
   SET DATE BRITISH
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO YEAR( DATE() ) - 30
   SET SOFTSEEK OFF
   SET WRAP ON
   SETCANCEL( .F. )
   SET CONFIRM OFF
   SET DELETED ON
   SET _3DLOOK ON
   SET UNIQUE OFF
   SET ESCAPE OFF
   SET EXACT ON       // CONTROLA O :=, = e ==
   SET EXCLUSIVE OFF
   SET MULTIPLE OFF
   SET OPTIMIZE ON

   SetBalloon( .T. )
   SkinButtons()

   DEFINE FONT oFont     NAME "Segoe UI" SIZE 0, -16
   DEFINE FONT oFontMenu NAME "Segoe UI" SIZE 0, -18

   cTitle := "MENU PRINCIPAL - Title del Window"

   DEFINE WINDOW oWnd MENU MyMenu() STYLE nOr( WS_POPUP )

   /*
   DEFINE WINDOW oWnd MENU MyMenu() TITLE cTitle                  ;
      STYLE nOr( WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_THICKFRAME, ;
                 WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX )
   */

   oWnd:SetColor( CLR_WHITE, Rgb( 44, 44, 44 ) )

   DEFINE BUTTONBAR oBar OF oWnd NOBORDER

   WITH OBJECT oBar

      oBar:nClrText := CLR_BLACK
      oBar:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

      oBar:bRClicked := { || NIL }
      oBar:bLClicked := { || NIL }

      oBar:SetFont( oFont )

      oBar:Adjust()

   END

   DEFINE BUTTON oBtn1 OF oBar FILENAME "..\bitmaps\16x16\new.bmp" FLAT ;
      ACTION MsgInfo( "New" ) ;
      TOOLTIP "Creates a new document" GROUP

   oBtn1:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BUTTON oBtn2 OF oBar FILENAME "..\bitmaps\16x16\open.bmp" FLAT ;
      ACTION MsgInfo( cGetFile( "*.*", "Select a document to open" ) ) ;
      TOOLTIP "Opens a document" WHEN .f. GROUP

   oBtn2:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BUTTON oBtn3 OF oBar FILENAME "..\bitmaps\16x16\floppy.bmp" FLAT ;
      ACTION MsgInfo( Time() ) TOOLTIP "Saves this document" GROUP

   oBtn3:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BUTTON oBtn4 OF oBar FILENAME "..\bitmaps\16x16\printer.bmp" FLAT ;
      ACTION MsgInfo( "Prints this document" ) TOOLTIP "Print this document" ;
      GROUP

   oBtn4:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BUTTON oBtn5 OF oBar FILENAME "..\bitmaps\16x16\prop.bmp" FLAT ;
      ACTION PrinterSetup() TOOLTIP "Setup the printer" GROUP

   oBtn5:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BUTTON oBtn6 OF oBar FILENAME "..\bitmaps\16x16\HelpInd.bmp" FLAT ;
      ACTION MsgInfo( Version() ) TOOLTIP "A multiple lines" + ;
      Chr( 13 ) + Chr( 10 ) + "tooltip!" GROUP

   oBtn6:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BUTTON oBtn7 OF oBar FILENAME "..\bitmaps\16x16\Help.bmp" FLAT ;
      ACTION MsgInfo( "fivewin power!" ) TOOLTIP "fivewin power!" GROUP

   oBtn7:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   DEFINE BUTTON oBtn8 OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT ;
      ACTION oWnd:End() TOOLTIP "Exit this app" GROUP

   oBtn8:Setcolor( CLR_GRAY, Rgb( 36, 36, 36 ) )

   // SET MESSAGE OF oWnd TO "© Contato Sistemas: (11) 2941-6446 / 3569-6446 " ;
   //    + "- Skype: joao@pleno.com.br" + " - www.pleno.com.br" FONT oFont     ;
   //    NOINSET CLOCK DATE KEYBOARD COLOR CLR_GRAY, Rgb( 44, 44, 44 )

   // O:
   SET MESSAGE OF oWnd TO "© Contato Sistemas: (11) 2941-6446 / 3569-6446 " ;
      + "- Skype: joao@pleno.com.br" + " - www.pleno.com.br" FONT oFont     ;
      COLOR CLR_GRAY, Rgb( 44, 44, 44 )

   DEFINE MSGITEM oMsgItem OF oWnd:oMsgBar PROMPT "Lock" SIZE 60           ;
      BITMAPS "..\bitmaps\16x16\lock.bmp", "..\bitmaps\16x16\unlock.bmp"   ;
      ACTION ( oMsgItem:lActive := !oMsgItem:lActive, oMsgItem:Paint() )

   DEFINE MSGITEM oMsgItemMail OF oWnd:oMsgBar SIZE 24 ;
      BITMAPS "..\bitmaps\16x16\MAIL.BMP"              ;
      TOOLTIP "Check the email" + CRLF + "Get email"

   DEFINE MSGITEM OF oWnd:oMsgBar            ;
      BITMAPS "..\bitmaps\16x16\PRINTER.BMP" ;
      ACTION PrinterSetup() ;
      TOOLTIP "Setup the printer"

   oWnd:oMsgBar:DateOn()
   oWnd:oMsgBar:ClockOn()

   DEFINE BITMAP oBmp FILENAME "..\bitmaps\BACK.bmp"  // WOW()!!

   oWnd:bPainted = { | hDC | BmpTiled( hDC, oWnd, oBmp ) }
   
   ACTIVATE WINDOW oWnd MAXIMIZED

   oFont:End()
   oFontMenu:End()

   HB_GCALL( .T. )

RETURN NIL

FUNCTION MyMenu()

   LOCAL oMenu
   
   MENU oMenu 2013 ;
      FONT oFontMenu ;
      HEIGHT -2 ;
      COLORMENU Rgb( 44, 44, 44 ), CLR_GRAY ;
      COLORSELECT CLR_WHITE, CLR_WHITE, Rgb( 100, 100, 100 ) ;
      COLORLINEBOTTOM Rgb( 44, 44, 44 )

      //MENUITEM FILE "..\bitmaps\VSCode48.png"
      MENUITEM FILE "..\bitmaps\PNGS\FiveTech.png"

      MENUITEM "Docs"

      MENUITEM "Update"

      MENUITEM "BLog"

      MENUITEM "Api"

      MENUITEM "Extensions"

      MENUITEM "FAQ"

      MENUITEM "Learn"

      MENUITEM "Salir" ACTION( oWnd:End() )

   ENDMENU

RETURN( oMenu )

STATIC FUNCTION BmpTiled( hDC, oWnd, oBmp )

   local nWidth := oWnd:nWidth(), nHeight := oWnd:nHeight()
   local nRow := 0, nCol := 0, n
   local nBmpWidth  := oBmp:nWidth(),  nBmpHeight := oBmp:nHeight()

   if oBmp:hBitmap == 0
      return nil
   endif

   while nRow < nHeight
      nCol = 0
      while nCol < nWidth
         PalBmpDraw( hDC, nRow, nCol, oBmp:hBitmap )
         nCol += nBmpWidth
      end
      nRow += nBmpHeight
   end

RETURN NIL

// FIN / END - kapiabafwh@gmail.com - Joao Santos - Sao Paulo - Brasil.
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion