English
Forum

SIMPLE Resize-routine

 

Christof
Neuß
Hi,

and here time again a Einsteigerfrage.

I have one very simple Mainwindow. therein only a couple Buttons and a couple Texts include. If the users the window vergrößert or minimizes should only The encompassed Objects entprechend larger or thin out (means prozentual to that Mainwindow). the can also gladly first to the release the Mouse button erfolgen.

fundamentally catch I with ...%key=4 So the incident ex and verzweige into Resize-routine.
there should I really only for all encompassed Objects The position and the Size new settle. How I these berechne is me too clear.

what I do not clear is:

How can I z.B. any encompassed Objects into aray pack, so these nacheinander worn out go, without I with one new Objekt think about must, this into Resize-routine einzubinden?

How can I The akutelle position the Objektes detect, circa then the new position To settle?

Perhaps have I but again time tomatoes on the eyes....

THANK YOU for each Help.
CompileMarkSeparation
 $P+
SET(ERRORLEVEL,0)
DECLARE RICHEDIT1&
DECLARE BUTTON1&,BUTTON2&,BUTTON3&,BUTTON4&,BUTTON5&,BUTTON6&,BUTTON7&,BUTTON8&
DECLARE Textfeld1&,ENDE%
DECLARE RADIOBUTTON1&, RADIOBUTTON2&
DECLARE Breite%, Hoehe%
DEF GETSYSCOLOR(1) !USER32,GetSysColor
VAR RZVersion$=X
VAR Arial16Fett&=Create(Font,Arial,16,0,1,0,0)
VAR Arial18Fett&=Create(Font,Arial,18,0,1,0,0)
WINDOWSTYLE 63
WINDOWTITLE Union Investment
WINDOW 143,41-756,587
CLS GETSYSCOLOR(15)
USEFONT ARIAL,16,0,0,0,0
SETDIALOGFONT 1
Breite%=Width(%HWND)
Hoehe%=Height(%HWND)
Hier kann ggf. Ihr Menü hin
BUTTON1&   = CREATE(BUTTON,%HWND,--- Bitte zuerst RZ-Version wählen ---,0020,0025,0450,0030)
BUTTON2&   = CREATE(BUTTON,%HWND,2. Union Investment-Volumina aus Internet ziehen,0020,0060,0450,0030)
BUTTON3&   = CREATE(BUTTON,%HWND,3. Stammdaten zur Berichtserstellung erfassen,0020,0095,0450,0030)
BUTTON4&   = CREATE(BUTTON,%HWND,4. Qualitative Fragen beantworten,0020,0130,0450,0030)
BUTTON5&   = CREATE(BUTTON,%HWND,5. Analyseprogramm starten,0020,0165,0450,0030)
BUTTON6&   = CREATE(BUTTON,%HWND,6. Auswertungsdatei versenden,0020,0200,0450,0030)
SetFont Button1&, Arial18Fett
SetFont Button2&, Arial18Fett
SetFont Button3&, Arial18Fett
SetFont Button4&, Arial18Fett
SetFont Button5&, Arial18Fett
SetFont Button6&, Arial18Fett
BUTTON7&  = CREATE(BUTTON,%HWND,Drucken,0662,0517,0070,0030)
BUTTON8&  = CREATE(BUTTON,%HWND,ENDE,0662,0199,0070,0030)
SetFont Button8&, Arial18Fett
RADIOBUTTON1& = CREATE(RADIOBUTTON,%HWND,BB3  ,0490,0165,0060,0030)
RADIOBUTTON2& = CREATE(RADIOBUTTON,%HWND,agree,0560,0165,0060,0030)

if RZVersion$=BB3

    SetCheck RADIOBUTTON1&,1
    SetText BUTTON1&, 1. Info-Abfragen erstellen

elseif RZVersion$=agree

    SetCheck RADIOBUTTON2&,1
    SetText BUTTON1&, 1. IDA-Abfragen erstellen

endif

Textfeld1& = CREATE(Text,%HWND,Bitte klicken Sie nacheinander die Buttons an.
Im unteren Textfeld werden Ihnen dann Hinweise
für die einzelnen Schritte gezeigt oder Daten abgefragt.,0490,0027,0254,0130)
SetFont Textfeld1&, Arial16Fett
RICHEDIT1& = CREATE(RICHEDIT,%HWND,,0018,0234,0716,-0277)
SETFOCUS(%HWND)
REPAINT

WHILENOT ENDE%

    WAITINPUT

    If %KEY=2 Schließ-X wurde geklickt

        ENDE%= 1

    ELSEIF %KEY=4  Größe wurde geändert

        Resize()

    ELSEIF CLICKED(BUTTON1&) BUTTON IDA-Abfragen oder Info-Abfragen

        IF GetCheck(RADIOBUTTON1&)=1

            HinweisText1BB3()

        elseIf GetCheck(RADIOBUTTON2&)=1

            HinweisText1agree()

        else

            MessageBox(Bitte zuerst RZ-Version wählen!!!,ACHTUNG,4144)

        ENDIF

    ELSEIF CLICKED(BUTTON2&) BUTTON

    ELSEIF CLICKED(BUTTON3&) BUTTON

    ELSEIF CLICKED(BUTTON4&) BUTTON

    ELSEIF CLICKED(BUTTON5&) BUTTON

    ELSEIF CLICKED(BUTTON6&) BUTTON

    ELSEIF CLICKED(BUTTON7&) BUTTON

    ELSEIF CLICKED(BUTTON8&) BUTTON

        ENDE%=1

    ELSEIF CLICKED(RADIOBUTTON1&)

        SetText BUTTON1&, 1. Info-Abfragen erstellen

    ELSEIF CLICKED(RADIOBUTTON2&)

        SetText BUTTON1&, 1. IDA-Abfragen erstellen

    ENDIF

ENDWHILE

DeleteObject Arial16Fett
DeleteObject Arial18Fett

PROC HinweisText1BB3

    SetText Richedit1&,
    Hier der eine Text

ENDPROC

PROC HinweisText1agree

    SetText Richedit1&,
    Und hier der andere Text

ENDPROC

PROC Resize

    VAR BreiteFaktor!=Width(%HWND)/Breite%
    VAR HoeheFaktor!=Height(%HWND)/Hoehe%
    VAR NeuePosW%=0
    VAR NeuePosS%=0
    VAR NeueBreite%=0
    V
NeueHoehe%=0 ENDPROC
 
Win10 16 GB RAM
02/11/09  
 



Christof Neuß
How can I z.B. any encompassed Objects into aray pack, so these nacheinander worn out go, without I with one new Objekt think about must, this into Resize-routine einzubinden?


Z.B. because You you a (pseudo) Markup-Language bereitstellst The whom pile the/your Controls according to your vergebenen Attributen anordnet. Komfortabel is the principle however (unfortunately) first then, if The Markup-Language properly powerful and elaborate is, means in Your drop plenty preparatory work. such Markup-Language should we Perhaps time together concern or. work out. One native example LookupAccountName is z.B. ProLayout [...]  of René.

Christof Neuß
How can I The akutelle position the Objektes detect, circa then the new position To settle?


The actually position z.B. by getClientRect [...]  , (but) circa a new position To settle (z.B. by setWindowPos) needed one The old position usually sooner not.

objectively is the space/provide the Controls the Grossteil the Aussenwirkung one Program and so (unfortunately) not to a einfachen Formel zusammenfassbar - The Solutions are mostly quite adjusted - and XProfan there lauter Lösungswege according to whom tatsächlichen Anforderungen on the program. [...]  [...]  [...]  [...] 

ex XProfan11 would I The SubClassProc benefit, circa on Changes the Size react to.

One Minimalbeispiel can I in the momentum not post.
 
02/11/09  
 




RGH
Hi,

so goes it:

1. I pack any items the Dialogs/Fensters into dynamisches aray. here in the example is it the aray Elemente&[]

2. I need two Apifunktionen and a structure:
DEF GetWindowRect(2) !"USER32","GetWindowRect"
DEF MapWindowPoints(4) !"USER32,MapWindowPoints"
STRUCT Groesse = X1&, Y1&, X2&, Y2&

GetWindowsRect determined The Bildschirmposition one Elementes and supply two Eckpunkte back: left supra and right under. The first Parameter is the lever the Elementes, the second The address the structure for both spots. After the Aifruf is the structure filled: In X1&/Y1& is the point left supra and X2&/Y&2 the point right under. ACHTUNG: The Coordinates relating itself on the screen (%DeskTop) and not our Window (%Hwnd)! here comes The zweie function to that employment:
MapWindowPoints rechnet The Coordinates circa: The first Parameter is the ursprüngliche Bezugspunkt (in unserem drop %DeskTop) and the second the desired Bezugspunkt (in unserem drop %HWnd). The dritte Parameter contains The address one Long-aray with the umzurechnenden Points. In unserem drop is the GROESSE# with two Points. The latest Parameter is the Number of spots, means here The 2.
Groesse is a structure The four Long-values for two spots contains and corresponds to accordingly the windows-structure RECT.

in the procedure Resize becomes now with GetWindowsRect for each element The Bildschirmposition determined and MapWindowPoints into %HWnd-position umgerechnet. Then the new position and Size under Berücksichtigung the wide- and Höhefaktors errechnet and SetWindowPos staid.

here the (something abgespeckte, but funktionsfähige) Program:
 $P+
SET("ERRORLEVEL",0)
DECLARE ENDE%
DECLARE wide%, Hoehe%
DECLARE Elemente&[]
DEF GetSysColor(1) !"USER32","GetSysColor"
DEF GetWindowRect(2) !"USER32","GetWindowRect"
DEF MapWindowPoints(4) !"USER32","MapWindowPoints"
STRUCT Groesse = X1&, Y1&, X2&, Y2&
DECLARE Groesse#
DIM Groesse#, Groesse
WINDOWSTYLE 63
WINDOWTITLE "Union Investment"
WINDOW 143,41-756,587
CLS GetSysColor(15)
Breite%=Width(%HWND)
Hoehe%=Height(%HWND)
Elemente&[0] = CREATE("BUTTON",%HWND,"--- Please first RZ-Version dial ---",0020,0025,0450,0030)
Elemente&[1] = CREATE("BUTTON",%HWND,"2. Union Investment-Volumina from internet ziehen",0020,0060,0450,0030)
Elemente&[2] = CREATE("BUTTON",%HWND,"3. Personal-Data to Berichtserstellung erfassen",0020,0095,0450,0030)
Elemente&[3] = CREATE("BUTTON",%HWND,"4. Qualitative ask beantworten",0020,0130,0450,0030)
Elemente&[4] = CREATE("BUTTON",%HWND,"5. Analyseprogramm starten",0020,0165,0450,0030)
Elemente&[5] = CREATE("BUTTON",%HWND,"6. Auswertungsdatei versenden",0020,0200,0450,0030)
Elemente&[6] = CREATE("BUTTON",%HWND,"Drucken",0662,0517,0070,0030)
Elemente&[7] = CREATE("BUTTON",%HWND,"ENDE",0662,0199,0070,0030)
Elemente&[8] = CREATE("RADIOBUTTON",%HWND,"BB3  ",0490,0165,0060,0030)
Elemente&[9] = CREATE("RADIOBUTTON",%HWND,"agree",0560,0165,0060,0030)
SetCheck Elemente&[8],1
SetText Elemente&[0]," 1. Info-inquire erstellen"
Elemente&[10] = CREATE("Text",%HWND,"Bitte clicking tappt im dunkeln nacheinander The Buttons on.",0490,0027,0254,0130)
'+
'in the downstairs Text box go them then Notes
'+ for individual steps viewed or data quizzed.
Elemente&[11] = CREATE("RICHEDIT",%HWND,"",0018,0234,0716,-0277)
SETFOCUS(%HWND)
REPAINT

WHILENOT ENDE%

    WAITINPUT

    If %KEY=2'Schließ-X watts clicked

        ENDE%= 1

    ELSEIF %KEY=4'Size watts changed

        Resize()

    ELSEIF CLICKED(Elemente&[0])'BUTTON IDA-inquire or Info-inquire

        IF GetCheck(Elemente&[8])=1

            HinweisText1BB3()

        elseIf GetCheck(Elemente&[9])=1

            HinweisText1agree()

        else

            MessageBox("Bitte first RZ-Version dial!!!","ACHTUNG",4144)

        ENDIF

    ELSEIF CLICKED(Elemente&[1])'BUTTON

    ELSEIF CLICKED(Elemente&[2])'BUTTON

    ELSEIF CLICKED(Elemente&[3])'BUTTON

    ELSEIF CLICKED(Elemente&[4])'BUTTON

    ELSEIF CLICKED(Elemente&[5])'BUTTON

    ELSEIF CLICKED(Elemente&[6])'BUTTON

    ELSEIF CLICKED(Elemente&[7])'BUTTON

        ENDE%=1

    ELSEIF CLICKED(Elemente&[8])

        SetText Elemente&[0], "1. Info-inquire erstellen"

    ELSEIF CLICKED(Elemente&[9])

        SetText Elemente&[0], "1. IDA-inquire erstellen"

    ENDIF

ENDWHILE

PROC HinweisText1BB3

    SetText Elemente&[11],"Hier the a Text"

ENDPROC

PROC HinweisText1agree

    SetText Elemente&[11],"Und here the others Text"

ENDPROC

PROC Resize

    VAR BreiteFaktor! = Width(%HWND)/wide%
    VAR HoeheFaktor!  = Height(%HWND)/Hoehe%
    wide%=Width(%HWND)
    Hoehe%=Height(%HWND)
    VAR NeuePosW%=0
    VAR NeuePosS%=0
    VAR NeueBreite%=0
    VAR NeueHoehe%=0

    WhileLoop 0, SizeOf(Elemente&[])-1

        GetWindowRect(Elemente&[&loop], Groesse#)
        MapWindowPoints(%DeskTop, %HWnd, Groesse#, 2)

        With Groesse#

            NeuePosW%   = Int(.X1& * BreiteFaktor!)
            NeuePosS%   = Int(.Y1& * HoeheFaktor!)
            NeueBreite% = Int((.X2& - .X1&) * BreiteFaktor!)
            NeueHoehe%  = Int((.Y2& - .Y1&) * HoeheFaktor!)

        EndWith

        SetWindowPos Elemente&[&loop] = NeuePosW%, NeuePosS% - NeueBreite%, NeueHoehe%

    EndWhile

ENDPROC


Greeting
Roland
 
Intel Duo E8400 3,0 GHz / 4 GB RAM / 1000 GB HDD - ATI Radeon HD 4770 512 MB - Windows 7 Home Premium 32Bit - XProfan X4
02/11/09  
 




Christof
Neuß
Ups,

had not virtual, that this so heavy is under XProfan. really is it still very profane.

Related to the

getClientRect

have I do not understood. If ichs correctly. see, I get still so only simply a part the Fensters back. I need but the Anfangskoordinaten z.B. the Richedit-Objektes.

my train of thoughts is following:
If I The akutellen positions and sizes the vorhandenen Objects know, can The Coordinates simply with the Vergrößerungs- (or Verkleinerungs-)factors for wide and Höhe multiplizieren and I so new initially- and Größenkoordinaten for each Objekt. now bräuchte I these only new settle (Oh man, How power one a existing Button because simply larger? I must yet plenty learn in XProfan!) and then new space. ready!

but so GEHTS well not, or?

thanks nevertheless!
I werd time try, me durchzuwurschteln. Can Yes only Experience with collect
 
Win10 16 GB RAM
02/11/09  
 




Christof
Neuß
Hello Roland,

thanks. now having itself your response and my BlaBla überschnitten.
will be first your response durcharbeiten...
 
Win10 16 GB RAM
02/11/09  
 




Christof
Neuß
the helps well moreover. super. thanks!

I can hereon set up!
 
Win10 16 GB RAM
02/11/09  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.245 Views

Themeninformationen

this Topic has 3 subscriber:

Christof Neuß (4x)
RGH (1x)
iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie