Change Text on ButtonBar!

Change Text on ButtonBar!

Postby Horizon » Mon Jun 26, 2023 12:47 pm

Hi,

I have a Text on ButtonBar via TSay class. I need to change it with pressing "Change It" button.

Any help?

Thanks.

Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oWnd, oBar, oBold, oFont1, oSay11

    DEFINE FONT oFont1 NAME "Arial" SIZE 0, -35
   
   DEFINE WINDOW oWnd TITLE "FWH17.04 : ButtonBar Group Labels"
   DEFINE BUTTONBAR oBar OF oWnd 2007 SIZE 56,56 HEIGHT 80

   oBold := oBar:oFont:Bold()
   oBar:oGrpFont  := oBold

   DEFINE BUTTON OF oBar  PROMPT "Change it" action Change_Text(oSay11)
    @ 3,100 say oSay11 Prompt "Test1" of oBar size 500,56 pixel TRANSPARENT FONT oFont1 CENTER VCENTER COLOR CLR_RED UPDATE

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oBold
   oFont1:=nil

return nil

function Change_Text(oSay)
    oSay:SetText("New Text")
    oSay:refresh()
return .t.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Change Text on ButtonBar!

Postby cmsoft » Mon Jun 26, 2023 1:22 pm

Una forma sería:
Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local oWnd, oBar, oBold, oFont1, oSay11, cText := "Test 1"

    DEFINE FONT oFont1 NAME "Arial" SIZE 0, -35
   
   DEFINE WINDOW oWnd TITLE "FWH17.04 : ButtonBar Group Labels"
   DEFINE BUTTONBAR oBar OF oWnd 2007 SIZE 56,56 HEIGHT 80

   oBold := oBar:oFont:Bold()
   oBar:oGrpFont  := oBold

   DEFINE BUTTON OF oBar  PROMPT "Change it" action Change_Text(oSay11,@cText)
    @ 3,100 say oSay11 Prompt cText of oBar size 500,56 pixel TRANSPARENT FONT oFont1 CENTER VCENTER COLOR CLR_RED UPDATE

   ACTIVATE WINDOW oWnd CENTERED
   RELEASE FONT oBold
   oFont1:=nil

return nil

function Change_Text(oSay,cText)
    cText := "New Text"
    oSay:Refresh()
return .t.
User avatar
cmsoft
 
Posts: 1292
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Change Text on ButtonBar!

Postby nageswaragunupudi » Tue Jun 27, 2023 3:21 am

Code: Select all  Expand view  RUN
function BarSay()

   local oWnd, oBar, oSay1, oSay2
   local cPrompt1 := "ONE"
   local nMth     := 0

   DEFINE WINDOW oWnd FROM 0,0 TO 300,500 PIXEL
   DEFINE BUTTONBAR oBar OF oWnd SIZE 45,45 2010

   DEFINE BUTTON OF oBar PROMPT "Change" CENTER ACTION ( ;
      cPrompt1 := If( cPrompt1 == "ONE", "TWO", "ONE" ), ;
      nMth  := ( ++nMth ) % 12, ;
      oBar:Refresh() )

   @ 3,100 SAY cPrompt1 SIZE 80,40 PIXEL OF oBar VCENTER
   @ 3,200 SAY { || ntocmonth( nMth + 1 ) } SIZE 80,40 PIXEL OF oBar VCENTER

   ACTIVATE WINDOW oWnd CENTERED

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10656
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Change Text on ButtonBar!

Postby Horizon » Tue Jun 27, 2023 3:03 pm

Thank you Mr. Rao, Cesar.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 15 guests