Dialog title

Dialog title

Postby pawelu » Tue Mar 06, 2007 7:53 am

Antonio,

How to set to second dialog title ? When second dialog is loaded, dialog title doesn't change.

Regards
Pawel

Code: Select all  Expand view
// prg file
#Include 'FwCe.Ch'

Function Test1 ()

   Local oDlg := Nil

   Define Dialog oDlg Resource 'TEST1'
   ReDefine Button Id 1001 of oDlg Action Test2 ()
   Activate Dialog oDlg On Init DlgFullScr (oDlg : hWnd)

Return .T.

Function Test2 ()

   Local oDlg := Nil

   Define Dialog oDlg Resource 'TEST2'
   Activate Dialog oDlg On Init DlgFullScr (oDlg : hWnd)
 
Return .T.

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>

HB_FUNC (DLGFULLSCR)
{
   SHINITDLGINFO shidi;
   HWND hDlg = (HWND) hb_parnl (1);

   shidi.dwMask  = SHIDIM_FLAGS;
   shidi.hDlg    = hDlg;
   shidi.dwFlags = SHIDIF_EMPTYMENU|SHIDIF_SIZEDLGFULLSCREEN;
   SHInitDialog (&shidi);
}

#pragma ENDDUMP

// rc file
#include <windows.h>
#include <commctrl.h>

LANGUAGE LANG_POLISH,SUBLANG_DEFAULT

TEST1 DIALOG DISCARDABLE 0, 0, 136, 154
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "TEST1"
FONT 10, "System"
BEGIN
  CONTROL "TEST1", 1001, "Button", WS_TABSTOP, 100, 140, 34, 11
END

TEST2 DIALOG DISCARDABLE 0, 0, 136, 154
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "TEST2"
FONT 10, "System"
BEGIN
  CONTROL "TEST2", 1001, "Button", WS_TABSTOP, 100, 140, 34, 11
END
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Re: Dialog title

Postby Enrico Maria Giordano » Tue Mar 06, 2007 8:17 am

oDlg:cTitle( "New title" )

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby pawelu » Tue Mar 06, 2007 9:08 am

Enrico,

Method cTitle() doesn't exist in dialog and window source. SetText() exists but doesn't work for second dialog call.

Regards
Pawel
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Enrico Maria Giordano » Tue Mar 06, 2007 9:22 am

Code: Select all  Expand view
METHOD cTitle( cNewTitle ) CLASS TWindow


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Tue Mar 06, 2007 10:06 am

Pawel,

It looks as a side effect for using DlgFullScr(). If you don't call this function, then the captions are shown ok.

This is a workaround to get it working:
Code: Select all  Expand view
static oDlg1, oDlg2

Function Test1 ()

   Define Dialog oDlg1 Resource 'TEST1'
   ReDefine Button Id 1001 of oDlg1 Action Test2 ()
   Activate Dialog oDlg1 On Init DlgFullScr (oDlg1 : hWnd)

Return .T.

Function Test2 ()

   Define Dialog oDlg2 Resource 'TEST2'
   Activate Dialog oDlg2 On Init ( DlgFullScr (oDlg2 : hWnd), oDlg1:SetText( "TEST2" ) )
   oDlg1:SetText( "TEST1" )
 
Return .T.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby pawelu » Tue Mar 06, 2007 11:10 am

Antonio,

Is there a method to set focus to dialog control ? In window this command work as expected:
Code: Select all  Expand view
Activate Window oWnd On Init oCtl : SetFocus ()

In dialog focus is set to first control with WS_TABSTOP message. Command:
Code: Select all  Expand view
Activate Dialog oDlg On Init oCtl : SetFocus ()

don't move focus to oCtl control.

Thanks for help
Pawel

Working sample:
Code: Select all  Expand view
// prg file
#Include 'FwCe.Ch'

Function Test ()

   Local oDlg := Nil
   Local oGet := Nil
   Local cGet := ''
   Local nGet := 999999.99

   Define Dialog oDlg Resource 'NALKPKW'
   ReDefine Get cGet Id 1015 Of oDlg MultiLine
   ReDefine Get oGet Var nGet Id 1018 Of oDlg Picture '999,999.99'
   Activate Dialog oDlg On Init (DlgFullScr (oDlg : hWnd), oGet : SetFocus ())

Return .T.

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>

HB_FUNC (DLGFULLSCR)
{
   SHINITDLGINFO shidi;
   HWND hDlg = (HWND) hb_parnl (1);

   shidi.dwMask  = SHIDIM_FLAGS;
   shidi.hDlg    = hDlg;
   shidi.dwFlags = SHIDIF_EMPTYMENU|SHIDIF_SIZEDLGFULLSCREEN;
   SHInitDialog (&shidi);
}

#pragma ENDDUMP

// rc file
#include <windows.h>
#include <commctrl.h>

LANGUAGE LANG_POLISH,SUBLANG_DEFAULT

NALKPKW DIALOG DISCARDABLE 0, 0, 136, 154
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_VISIBLE
CAPTION "KP/KW"
FONT 10, "System"
BEGIN
  CONTROL "Numer:", 1001, "Static", SS_RIGHT|WS_GROUP, 0, 2, 26, 11
  CONTROL "Data:", 1002, "Static", SS_RIGHT|WS_GROUP, 0, 14, 26, 11
  CONTROL "Klient:", 1003, "Static", SS_RIGHT|WS_GROUP, 0, 26, 26, 11
  CONTROL "Tytul:", 1004, "Static", SS_RIGHT|WS_GROUP, 0, 48, 26, 11
  CONTROL "Wart/Z:", 1005, "Static", SS_RIGHT|WS_GROUP, 0, 80, 26, 11
  CONTROL "Kwota:", 1006, "Static", SS_RIGHT|WS_GROUP, 0, 92, 26, 11
  CONTROL "Nr wew:", 1007, "Static", SS_RIGHT|WS_GROUP, 68, 92, 30, 11
  CONTROL "Ulica:", 1008, "Static", SS_RIGHT|WS_GROUP, 0, 104, 26, 11
  CONTROL "Pna:", 1009, "Static", SS_RIGHT|WS_GROUP, 0, 116, 26, 11
  CONTROL "Miasto:", 1010, "Static", SS_RIGHT|WS_GROUP, 0, 128, 26, 11
  CONTROL "", 1011, "Edit", ES_AUTOHSCROLL|ES_UPPERCASE|ES_READONLY|WS_BORDER, 26, 2, 42, 11
  CONTROL "", 1012, "Edit", ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 26, 14, 42, 11
  CONTROL "", 1013, "Edit", ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 70, 14, 42, 11
  CONTROL "", 1014, "Edit", ES_MULTILINE|ES_AUTOVSCROLL|ES_UPPERCASE|ES_READONLY|WS_VSCROLL|WS_BORDER, 26, 26, 108, 21
  CONTROL "", 1015, "Edit", ES_MULTILINE|ES_AUTOVSCROLL|ES_UPPERCASE|WS_VSCROLL|WS_BORDER|WS_TABSTOP, 26, 48, 108, 31
  CONTROL "", 1016, "Edit", ES_RIGHT|ES_NUMBER|ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 26, 80, 42, 11
  CONTROL "", 1017, "Edit", ES_RIGHT|ES_NUMBER|ES_AUTOHSCROLL|ES_READONLY|WS_BORDER, 70, 80, 42, 11
  CONTROL "", 1018, "Edit", ES_RIGHT|ES_NUMBER|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 26, 92, 42, 11
  CONTROL "", 1019, "Edit", ES_RIGHT|ES_NUMBER|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP, 98, 92, 36, 11
  CONTROL "", 1020, "Edit", ES_AUTOHSCROLL|ES_UPPERCASE|ES_READONLY|WS_BORDER, 26, 104, 108, 11
  CONTROL "", 1021, "Edit", ES_AUTOHSCROLL|ES_UPPERCASE|ES_READONLY|WS_BORDER, 26, 116, 32, 11
  CONTROL "", 1022, "Edit", ES_AUTOHSCROLL|ES_UPPERCASE|ES_READONLY|WS_BORDER, 26, 128, 108, 11
  CONTROL "Zapisz", 1023, "Button", WS_TABSTOP, 64, 140, 34, 11
  CONTROL "Anuluj", 1024, "Button", WS_TABSTOP, 100, 140, 34, 11
END
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Antonio Linares » Tue Mar 06, 2007 11:34 am

Pawel,

You have to do it this way:
Code: Select all  Expand view
Activate Dialog oDlg On Init ( oCtl : SetFocus () , .F. )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42071
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 13 guests