| |

VerySource

 Forgot password?
 Register
Search
View: 35|Reply: 15

Form sticking problem

[Copy link]

2

Threads

7

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

Post time: 2020-1-19 20:00:01
| Show all posts |Read mode
The parent form has an edit control TRichEdit, and the parent form's FormStyle = fsStayOnTop. Now a new child form (not a multi-document form) is opened. It is required that this form always floats on the parent form, and It cannot be a modal form. In fact, it is similar to the effect of opening the TFindDialog form on the edit form. This can be achieved in C # with the following code:
Form dlgFind = new Form ();
AddOwnedForm (dlgFind);
dlgFind.Show ();
But I don't know how to achieve it in CBC.
Reply

Use magic Report

0

Threads

13

Posts

13

Credits

Newbie

Rank: 1

Credits
13

 China

Post time: 2020-1-27 15:45:01
| Show all posts
Search for the code of the floating form by yourself. In fact, there are many ways to stick the form, but most of them are not absolute.
Reply

Use magic Report

0

Threads

3

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-2-4 23:45:01
| Show all posts
Set the formstyle of the form to fsStayOnTop! !!
Reply

Use magic Report

2

Threads

7

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

 Author| Post time: 2020-3-11 12:45:01
| Show all posts
"It is possible to set the formstyle of the form to fsStayOnTop !!!"

This method does not work. After the default form is started, the form floats on the parent form. Once the form loses focus or the parent form regains focus, the form sinks behind the parent form.
Reply

Use magic Report

0

Threads

2

Posts

3

Credits

Newbie

Rank: 1

Credits
3

 China

Post time: 2020-3-13 20:30:02
| Show all posts
Overload Form's virtual function CreateParams, change the member of TCreateParams WndParent
 
class TForm2: public TForm
{
__published: // IDE-managed Components
private: // User declarations
protected:
       virtual void __fastcall CreateParams (TCreateParams&Param);
public: // User declarations
       __fastcall TForm2 (TComponent * Owner);
};
 
void __fastcall TForm2 :: CreateParams (TCreateParams&Param)
{
       // Call the function of the base class
       TForm :: CreateParams (Param);
       Param.ExStyle | = WS_EX_TOPMOST;
       Param.WndParent = GetDesktopWindow ();
}
Reply

Use magic Report

0

Threads

4

Posts

5

Credits

Newbie

Rank: 1

Credits
5

 China

Post time: 2020-3-16 17:30:02
| Show all posts
mark
Reply

Use magic Report

2

Threads

7

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

 Author| Post time: 2020-4-14 07:30:01
| Show all posts
to:cooler42
This method still does not work, the effect is the same as TForm2-> formstyle = fsStayOnTop, when the parent form is the active form, the child form can not float on it.
Because the parent form itself is formstyle = fsStayOnTop
Reply

Use magic Report

0

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-5-23 22:30:02
| Show all posts
Bangding
Reply

Use magic Report

0

Threads

11

Posts

9

Credits

Newbie

Rank: 1

Credits
9

 China

Post time: 2020-5-26 17:30:01
| Show all posts
Strongly despise that both the parent form and the child form are FormStyle = fsStayOnTop, which affects the use of other software. Simply develop your own operating system and only run the programs you write.
Reply

Use magic Report

2

Threads

7

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

 Author| Post time: 2020-7-5 11:30:01
| Show all posts
TO:光明之行者
Do you know what I want to write?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list