First question: I want to dynamically modify A StaticText controls the OnClick event, if meet the conditions for A, will be set for the OnClick event Buttion1 OnButton1Click, otherwise we are set to NULL, due to the Caption StaticText, Hint, the Tag will be along with the changes, and the number of its modification will be very much, want to encapsulated into A function, the parameters of the function with A triggering event, how do I define the function, the event variable in the function body how to assign A value?
Second question: ListBox Click event will trigger the current edit documents of closed and open a new document, but the current document whether to choose whether you want to continue editing, Click will take effect, the Index has directed a new document, don't know is there any way to achieve such as TreeView OnChanging method, can prevent the happening of the change,
The third question: in the TreeView node sliding the mouse, the mouse trajectory accompanies by a translucent window display node information (similar to Hint, but the use of the form), but once ShowModal translucent form, the TreeView MouseMove doesn't work, how to solve the problem? The Show also not line, so translucent form which passes,
CodePudding user response:
Void __fastcall Button1Click (TObject * Sender);
Void __fastcall StaticText1Click (TObject * Sender);
Void __fastcall Button2Click (TObject * Sender);
Void __fastcall TForm1: : StaticText1Click (TObject * Sender)
{
ShowMessage (" StaticText1Click ");
}
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Void __fastcall TForm1: : Button1Click (TObject * Sender)
{
This - & gt; StaticText1 - & gt; The OnClick=Button2Click;
}
Void __fastcall TForm1: : Button2Click (TObject * Sender)
{
ShowMessage (" Button2Click ");
}
CodePudding user response:
ShowModal certainly not, don't delete also won't disappear after the showCodePudding user response:
I try so hard, the three written together, express,If I write a function to the dynamic invocation parameters, when the parameter is NULL, what all don't, equals Button2Click execute it, and how the function definition, implementation? I don't know how to write parameters, how to do,
CodePudding user response:
I'm sorry, I forget to say it is a real time detect where the mouse position changes, the node has changed, the old translucent window closed, create a new, rather than the form changes to the original content and position,CodePudding user response:
This - & gt; StaticText1 - & gt; The OnClick=NULL; Click on what all goodCodePudding user response:
//a custom functionVoid TMainFrm: : ShowTips (AnsiString Tips, AnsiString Hint, void * Events, int KeepTime)
{
STxt_EditTip - & gt; Caption=Tips;
STxt_EditTip - & gt; Hint=Hint;
//sTxt_EditTip - & gt; The OnClick=(void *) Events;
STxt_EditTip - & gt; The Tag=KeepTime;
}
Events trigger A
ShowTips (" tip "pure," of "pure tips, click is invalid, NULL, 5);//click sTxt_EditTip unresponsive to
Events trigger B
ShowTips (" effect prompt clicks, "" pure tips, click on the" effective, Button1Click, 5);//click sTxt_EditTip triggers Button1Click
OnClick above the line has been commented out, because of an error, don't know how to write, or function definition is not it