Hi.
I have a lot of resource dialogs with objects like SAY with ID -1.
I need get it to change some properties like fonts and colors.
There are a way to get it without change ID ?
TIA, best regards,
Toninho.
Hi.
I have a lot of resource dialogs with objects like SAY with ID -1.
I need get it to change some properties like fonts and colors.
There are a way to get it without change ID ?
TIA, best regards,
Toninho.
ACTIVATE DIALOG oDlg CENTERED ON INIT MySays(oDlg)
//--------------------
Function MySays(oDlg)
local n
For n := 1 to len(oDlg:aControls)
  //if oDlg:aControls[n]:CLASSNAME == "TSAY"
   //MsgInfo(oDlg:aControls[n]:cTitle)
   msginfo(oDlg:aControls[n]:CLASSNAME)
  //endif
Next
Return nil#define GW_CHILD Â Â Â 5
#define GW_HWNDNEXT Â 2
#define GWL_ID Â -12
function FindControlsById( oDlg )
  local n, hCtrl := GetWindow( oDlg:hWnd, GW_CHILD )
  WHILE hCtrl != 0
   if GetWindowLong( hCtrl, GWL_ID ) == -1 // You may also use GetClassName( hCtrl ) == cClassName
     ...
   endif
   hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
  END
return nilNice hint Francisco and Antonio.
But Antonio's solution is that i'm looking for.
Thank you.
#include "FiveWin.ch"
#include "xbrowse.ch"
#define GW_CHILD 5
#define GW_HWNDNEXT 2
#define GWL_ID -12
//----------------------------------------------------------------------------//
function Main()
local oDlg, lSave := .f.
local c100 := "TEST ELVIRA "
local c101 := 0
local c102 := 0
local c103 := 0
DEFINE DIALOG oDlg RESOURCE "ELVIRA" TITLE "Prueba Elvira"
REDEFINE GET c100 ID 100 OF oDlg
REDEFINE GET c101 ID 101 OF oDlg PICTURE "@E 9,999,999" SPINNER
REDEFINE GET c102 ID 102 OF oDlg PICTURE "@E 9,999,999"
REDEFINE GET c103 ID 103 OF oDlg PICTURE "@E 9999" SPINNER
REDEFINE BUTTON ID 701 OF oDlg ACTION( lSave := .T., oDlg:End() )
REDEFINE BUTTON ID 702 OF oDlg ACTION( lSave := .F., oDlg:End() )
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT FindControlsById( oDlg )
return nil
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
function FindControlsById( oDlg )
//----------------------------------------------------------------------------//
local n, hCtrl := GetWindow( oDlg:hWnd, GW_CHILD )
WHILE hCtrl != 0
if GetWindowLong( hCtrl, GWL_ID ) == -1 // You may also use GetClassName( hCtrl ) == cClassName
alert(" ...")
endif
hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
END
return nil
//----------------------------------------------------------------------------//function FindControlsById( oDlg )
//----------------------------------------------------------------------------//
local n, hCtrl := GetWindow( oDlg:hWnd, GW_CHILD )
WHILE hCtrl != 0
MsgInfo( GetClassName( hCtrl ) ) // new
if GetWindowLong( hCtrl, GWL_ID ) == -1 // You may also use GetClassName( hCtrl ) == cClassName
alert(" ...")
endif
hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
END
return nil// RESOURCE SCRIPT generated by "Pelles C for Windows, version 7.00".
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US
ELVIRA DIALOG DISCARDABLE 23, 16, 258, 163
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION
CAPTION "Búsquedas"
FONT 10, "MS Sans Serif"
{
CONTROL "", 100, "Edit", ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 51, 14, 86, 12
CONTROL "", 101, "Edit", ES_RIGHT|ES_AUTOHSCROLL|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 52, 60, 49, 11
CONTROL "", 102, "Edit", ES_RIGHT|WS_BORDER|WS_TABSTOP, 152, 60, 24, 11
CONTROL "", 103, "Edit", ES_RIGHT|ES_NUMBER|ES_AUTOVSCROLL|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 208, 60, 36, 11
CONTROL "&Nombre:", -1, "Static", WS_GROUP, 10, 16, 28, 8
CONTROL "&Págs.:", -1, "Static", SS_RIGHT|WS_GROUP, 184, 60, 19, 12
CONTROL "&Vols:", -1, "Static", SS_RIGHT|WS_GROUP, 30, 63, 17, 8
CONTROL "&Ejemplares:", -1, "Static", SS_RIGHT|WS_GROUP, 112, 60, 38, 8
CONTROL "&Aceptar", 701, "Button", WS_TABSTOP, 73, 128, 36, 14
CONTROL "&Cancelar", 702, "Button", WS_TABSTOP, 140, 128, 36, 14
}The "Static" ones are the ones that have -1 ![]()
Antonio,
And can you please teach us how to change the SAY´s text in rutime mode?.
Elvira,
If you want to change the text, attributes, etc of a SAY then you have to REDEFINE it:
REDEFINE SAY oSay ID ... OF oDlg
...
ACTIVATE DIALOG ...
and from your app simply do oSay:SetText( cNewText )
of course, you have to change -1 in the RC with a different value
An alternative solution to your problem, one dll for each language with all RC inside. Then you can translate DLL, and select the appropiate DLL depending on Sys language.
Elvira,
Biel´s solution is the right one, unless you want to set different IDs for all your Static (SAYs) controls.
FiveWin provides several ways to manage them as a group, but for changing texts in each of them, there is no other way of different IDs or the right way as Biel explains ![]()
elvira wrote:And can you please teach us how to change the SAY´s text in rutime mode?.
SetWindowText( hCtrl, "New text" ) if GetWindowText( hCtrl ) = "&Ejemplares:"
SetWindowText( hCtrl, "New text:" )
endif