hi Frank,
Frank Grossheinrich hat geschrieben: ↑Fr, 05. Mai 2023 12:00 Obwohl mich fast wundert, wenn der gezeigte Code funktionieren würde. Denn einfach eine neue :caption zuzuweisen, zeigt in aller Regel noch nix Neues an. Dafür gibt es eigentlich die Methode :setCaption() oder man muss die Instanz durch den Lebenszyklus jagen und :configure() aufrufen.
wieso soll die Syntax falsch sein
Code: Alles auswählen
METHOD AenderCaption(cNeuCaption)
::Status:Caption := cNeuCaption
RETURN self
- dasgehtso.jpg (26.35 KiB) 2368 mal betrachtet
probiere mal das (ENDE klicken)
Code: Alles auswählen
#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "Appevent.ch"
#include "Font.ch"
#include "DLL.CH"
#include "NLS.ch"
PROCEDURE APPSYS
LOCAL cTitle := "DispoEingabe"
LOCAL hWndDlg := DllCall( "User32.dll", DLL_STDCALL, "FindWindowA", 0, cTitle )
IF !( hWndDlg == 0 )
DllCall( "User32.dll", DLL_STDCALL, "SetForegroundWindow", hWndDlg )
DllCall( "User32.dll", DLL_STDCALL, "BringWindowToTop", hWndDlg )
DllCall( "User32.dll", DLL_STDCALL, "ShowWindow", hWndDlg, 1 )
DllCall( "User32.dll", DLL_STDCALL, "UpdateWindow", hWndDlg )
*** It is a second instance.... Bye Bye
QUIT
ENDIF
RETURN
******************************************************************************
* Main procedure to test a form
******************************************************************************
PROCEDURE Main
LOCAL nEvent, oXbp, mp1, mp2
LOCAL oDlg
SET EXCLUSIVE OFF // Netzwerk SHARE
SET EPOCH TO YEAR( DATE() ) - 50
SET CENTURY OFF
SET DATE GERMAN
SETLOCALE( NLS_ICURRENCYEURO, "1" )
SETLOCALE( NLS_SCURRENCY, CHR( 213 ) )
oDlg := DispoEingabe():New():Create()
oDlg:Button1:activate := {|| MsgBox("Hello 1") }
oDlg:Button2:activate := {|| MsgBox("Hello 2") }
oDlg:Button3:activate := {|| MsgBox("Hello 3") }
oDlg:Button4:activate := {|| oDlg:AenderCaption("hallo Frank") }
oDlg:AenderCaption("das geht oder nicht")
nEvent := xbe_None
WHILE nEvent != xbeP_Close
nEvent := AppEvent ( @mp1, @mp2, @oXbp )
oXbp:HandleEvent ( nEvent, mp1, mp2 )
IF nEvent == xbeP_Quit
QUIT // AppQuit()
ENDIF
ENDDO
RETURN
******************************************************************************
* This class is derived from the implementation-level class of the form.
* Instance variables are declared in the _DispoEingabe class.
******************************************************************************
CLASS DispoEingabe FROM _DispoEingabe
EXPORTED:
METHOD init
METHOD create
METHOD AenderCaption()
ENDCLASS
******************************************************************************
* Initialize form
******************************************************************************
METHOD DispoEingabe:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
* Execute method of the super class
::_DispoEingabe:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
RETURN self
******************************************************************************
* Request system resources
******************************************************************************
METHOD DispoEingabe:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
* Execute method of the super class
::_DispoEingabe:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
* Display the form
::show()
RETURN self
METHOD AenderCaption(cNeuCaption)
::Status:Caption := cNeuCaption
RETURN self
* Include program code for the implementation-level class of the form
#include "_DISPOEINGABE.PRG"
//EOF
Code: Alles auswählen
#ifndef _DISPOEINGABE_
#define _DISPOEINGABE_
#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
#include "Appevent.ch"
#include "Font.ch"
#PRAGMA LIBRARY( "ascom10.lib" )
CLASS _DispoEingabe FROM XbpDialog
EXPORTED:
VAR editControls
* Contained control elements
VAR Button2
VAR Button4
VAR Button1
VAR Status
VAR Button3
METHOD init
METHOD create
ENDCLASS
******************************************************************************
* Initialize form
******************************************************************************
METHOD _DispoEingabe:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
DEFAULT oParent TO AppDesktop(), ;
aPos TO {-4,550}, ;
lVisible TO .F. , ;
aPP TO {}
AAdd ( aPP, { XBP_PP_BGCLR, GRA_CLR_DARKCYAN } )
AAdd ( aPP, { XBP_PP_FGCLR, GRA_CLR_BLACK } )
AAdd ( aPP, { XBP_PP_COMPOUNDNAME, "24.Arial" } )
IF Empty(aSize) == .T.
IF IsMemberVar(self,"ClientSize") == .T.
aSize := {0,0}
ELSE
aSize := {441,527}
ENDIF
ENDIF
::XbpDialog:init( oParent, oOwner, aPos, aSize, aPP, lVisible )
IF aSize[1] == 0 .AND. aSize[2] == 0
::XbpDialog:ClientSize := {425,488}
ENDIF
::XbpDialog:drawingArea:ColorBG := GRA_CLR_DARKCYAN
::XbpDialog:taskList := .T.
::XbpDialog:title := "DispoEingabe"
::editControls := {}
::Button2 := XbpPushButton():new( ::drawingArea, , {56,160}, {300,120}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
::Button2:caption := "EINGABE"
::Button2:tabStop := .T.
::Button2:activate := {|| NIL }
::Button4 := XbpPushButton():new( ::drawingArea, , {284,8}, {132,60}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
::Button4:caption := "ENDE"
::Button4:tabStop := .T.
::Button4:activate := {|| NIL }
::Button1 := XbpPushButton():new( ::drawingArea, , {56,300}, {300,120}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
::Button1:caption := "DISPOLISTE"
::Button1:tabStop := .T.
::Button1:activate := {|| NIL }
::Status := XbpStatusBar():new( ::drawingArea, , {12,440}, {400,40} )
::Button3 := XbpPushButton():new( ::drawingArea, , {56,80}, {300,60}, { { XBP_PP_BGCLR, XBPSYSCLR_BUTTONMIDDLE }, { XBP_PP_FGCLR, -58 } } )
::Button3:caption := "Daten bertragen"
::Button3:tabStop := .T.
::Button3:activate := {|| NIL }
RETURN self
******************************************************************************
* Request system resources
******************************************************************************
METHOD _DispoEingabe:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
::XbpDialog:create( oParent, oOwner, aPos, aSize, aPP, lVisible )
::Button2:create()
::Button4:create()
::Button1:create()
::Status:create()
::Status:Caption := "Arbeitsjahr:"
::Button3:create()
RETURN self
#endif
//EOF
/////