Modifly on fly text of Say and button objects

Modifly on fly text of Say and button objects

Postby MarcoBoschi » Mon Dec 08, 2014 5: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: Select all  Expand view

#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: Select all  Expand view

// 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
}
 
User avatar
MarcoBoschi
 
Posts: 1018
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Modifly on fly text of Say and button objects

Postby Gale FORd » Mon Dec 08, 2014 7: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Modifly on fly text of Say and button objects

Postby fgondi » Mon Dec 08, 2014 9: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: Select all  Expand view
  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
User avatar
fgondi
 
Posts: 694
Joined: Fri Oct 07, 2005 6:58 am
Location: Palencia, España

Re: Modifly on fly text of Say and button objects

Postby MarcoBoschi » Tue Dec 09, 2014 8: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
User avatar
MarcoBoschi
 
Posts: 1018
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 48 guests