FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Modifly on fly text of Say and button objects
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Modifly on fly text of Say and button objects
Posted: Mon Dec 08, 2014 05:36 PM
Hi,
This is the question:
In function "traduci" I modify the text of tsay and tbutton objects in the dialog

There are other not-redefined object in RC files
Is it possible to modify these objects too?
(NOT REDEFINED)

Thanks to all
Marco


Code (fw): Select all Collapse
#include "fivewin.ch"

FUNCTION MAIN()

LOCAL oDlg
LOCAL oSay1
LOCAL oBut1


DEFINE DIALOG oDlg RESOURCE "DIALOGO"

REDEFINE SAY oSay1 PROMPT "Primo Testo" ID 401 OF oDlg
REDEFINE BUTTON oBut1 ID 201 OF oDlg


ACTIVATE DIALOG oDlg ON INIT traduci( oDlg )


RETURN NIL
FUNCTION TRADUCI( oDlg )
LOCAL j , oCtl

FOR j = 1 TO LEN( oDlg:aControls )

    oCtl = oDlg:aControls[ j ]
    IF oCtl:classname = "TSAY" .OR.  oCtl:classname = "TBUTTON"
       oCtl:settext( "MARCO" )
    ENDIF
NEXT j

RETURN NIL



This is RC file
Code (fw): Select all Collapse
// RESOURCE SCRIPT generated by "Pelles C for Windows, version 6.00".

#include <windows.h>
#include <commctrl.h>
#include <richedit.h>

DIALOGO DIALOG DISCARDABLE 10, 28, 399, 136
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Dialogo"
FONT 8, "MS Sans Serif"
{
  CONTROL "First Say", 401, "Static", WS_GROUP, 4, 8, 56, 10
  CONTROL "", 101, "Edit", WS_BORDER|WS_TABSTOP, 68, 7, 134, 12
  CONTROL "Send", 201, "Button", BS_DEFPUSHBUTTON|WS_TABSTOP, 80, 80, 84, 24
  CONTROL "Cancel", 202, "Button", WS_TABSTOP, 176, 80, 84, 24
  CONTROL "Second Say", 402, "Static", WS_GROUP, 4, 25, 56, 10
  CONTROL "", 102, "Edit", WS_BORDER|WS_TABSTOP, 68, 24, 134, 12
}
Marco Boschi
info@marcoboschi.it
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Modifly on fly text of Say and button objects
Posted: Mon Dec 08, 2014 07:29 PM

Yes. You could would work on oDlg:aControls[ j ] the same whether they are from redefined from resource or defined directly.
I do that all the time with both. Sometimes I also use the cargo to place names so I don't have to keep the get object around, I can just check the name in the cargo to get the correct control.

Posts: 694
Joined: Fri Oct 07, 2005 06:58 AM
Re: Modifly on fly text of Say and button objects
Posted: Mon Dec 08, 2014 09:43 PM
Marco,

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=16270&hilit=gwl+id+GW_CHILD

I use this code to find the controls defined to -1, and change the language
Code (fw): Select all Collapse
   hCtrl := GetWindow( oDlg:hWnd, GW_CHILD )
   WHILE hCtrl != 0
      if GetWindowLong( hCtrl, GWL_ID ) == -1 
        cTxt  := GetWindowText( hCtrl )
        cLang := GHE_GetIdioma( cTxt ) 
        SetWindowText( hCtrl, cLang )
      endif
      hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
   END
Un saludo

Fernando González Diez

ALSIS Sistemas Informáticos
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Modifly on fly text of Say and button objects
Posted: Tue Dec 09, 2014 08:20 AM
Ok Thank You very Much

It works in this way not -1 but 65535


if GetWindowLong( hCtrl, GWL_ID ) == 65535

I use Pelles

Best regards
Marco
Marco Boschi
info@marcoboschi.it

Continue the discussion