delphi控件visible使用的一个bug(是否bug)

btlxy 2006-10-16 11:36:48
1 在一个form1中,有一个page control,可以动态生成tabsheet
2 动态生成form2 ,放置在tabsheet上
3 在form2 中的show事件,可以改变控件的visible
问题:控件的visible=false ,控件可以看见。

form1源码:

unit FormPageForm;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin;

type
TForm1 = class(TForm)
ToolBar1: TToolBar;
btnPage: TToolButton;
PageControl1: TPageControl;
procedure btnPageClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

uses
FormInPage;

procedure TForm1.btnPageClick(Sender: TObject);
var
Form: TForm;
Sheet: TTabSheet;
begin
// create a tabsheet within the page control
Sheet := TTabSheet.Create(PageControl1);
Sheet.PageControl := PageControl1;
// create the form and place it in the tabsheet
Form := TForm2.Create (Application);
Form.BorderStyle := bsNone;
Form.Align := alClient;
Form.Parent := Sheet;
Form. Visible := True;
// activate and set title
PageControl1.ActivePage := Sheet;
Sheet.Caption := Form.Caption;
end;

end.


form2源码:
unit FormInPage;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;

type
TForm2 = class(TForm)
RichEdit1: TRichEdit;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FormShow(Sender: TObject);
begin
Edit1.Visible:=False;
Label1.Visible :=False;
Edit2.Visible:=True;
Label2.Visible :=True;

Self.Repaint;

end;

end.


------------------------------
[?]忘各位能帮助解决,谢谢!
...全文
283 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
btlxy 2006-10-21
  • 打赏
  • 举报
回复
liangqingzhi(老之) :
其实属性值已经设置成功了,只是显示的问题了
comanche 2006-10-21
  • 打赏
  • 举报
回复
没想过要这么作, 另一种方法也可以把 Form 作为 PageControl 的 Sheet

Form := TForm2.Create (Application);
Form.ManualDock(PageControl1, nil, alClient);
Form.Visible := True; 这句完全等同于 Form.Show

这样作完后
Sheet.Caption = Form.Caption 代码激活某叶可以用这个
老之 2006-10-16
  • 打赏
  • 举报
回复
后来看了一下,OnShow里的其实是执行的,但被改了回来。问题是在PageControl1.ActivePage := Sheet;这一句,要放在Form. Visible := True;前面。
btlxy 2006-10-16
  • 打赏
  • 举报
回复
liangqingzhi(老之) :

请问;为何原来的操作就不可以呢?
老之 2006-10-16
  • 打赏
  • 举报
回复
将隐藏控件的代码放在OnCreate事件里面,或者在ToolButton点击事件里加一句Form.Show
btlxy 2006-10-16
  • 打赏
  • 举报
回复
大家执行时,点击form1中create page 按钮,多次,就可发现问题
DELPHI7下好用的托盘控件,安装简单,版本进度如下:TCoolTrayIcon, ver. 2.3.0 - ver. 2.3.0: Various minor bugs fixed: 1) Calling the ShowMainForm and HideMainForm methods before the main form was created would crash the app. Fixed thanks to James Legg. 2) The tooltip would give trouble if it was 64 chars. Thanks to Toms Baugis and Teus de Jong. 3) The popup menu would not close itself auto- matically if the StartMinimized property was true. Thanks to Ingo Krueger, Chris Witt, and Reister HansJoerg. - ver. 2.2.2: When there was more than one form visible the taskbar icon would not hide when the main form was minimized. Fixed. - ver. 2.2.1: Fixed a popup menu bug. Also fixed a bug which meant D2 and D3 users could not compile the component. Added more icon animations in the demo. Thanks to Daniele Gervasoni for the "tray graph". - ver. 2.2.0: IconIndex is now a property, allowing you to specify an icon at run-time. The OnCycle event is changed so it returns the index to the next icon that will display when cycling. Finally, I fixed a bug that caused the taskbar icon not to display itself when MinimizeToTray was true. Thanks to Lorenz Graf for pointing it out to me. - ver. 2.1.4: The main form will no longer show itself untimely after the form's BorderStyle property is changed. Thanks to Thomas Reimann. - ver. 2.1.3: Fixed a bug that caused the main form not to display itself (how embarassing). - ver. 2.1.2: I *finally* found the bug that would cause some compound controls (like controls on notebook pages or tab sheets) not to display properly when StartMinimized was true. Incidently, this also means that TForm.Position now works. Also fixed a minor bug that caused modal forms owned by the main form to appear behind the main form when the popup menu appeared (thanks to Arash Ramin). - ver. 2.1.1: Added notification method to properly detect whether the associated popup menu and imagelist are deleted. Thanks to
一个老外(西班牙)编写的控件,封装了全部google maps api ,使用DELPHI使用谷歌地图变得非常简单 GMLib - Google Maps Library Send suggestions to gmlib@cadetill.com Supported Delphi version: Delphi 6, 7, 2007, 2010, XE2, XE3 Tested Windows Versions: XP, 2003, Vista, 7 Change History january 14, 2013 - Google Maps Library v0.1.9 - Improvement: Compatible with FMX framework. - Improvement: About all Geometry Library coded. - bug fixed: Some bugs fixes. - Attempt to do compatible with DCEF components. October 05, 2012 - Google Maps Library v0.1.8 - Improvement: Compiled under XE3 - Improvement: new component added, the TGMElevation. - bug fixed: General -> fixed all memory leaks found - bug fixed: TGMDirection -> the OnDirectionsChanged event was not triggered - Improvement: TBasePolyline -> class TLinePoints and TLinePoint is disassociated from TPolyline and they are transferred to GMClasses - Improvement: TBasePolyline -> implements ILinePoint interface September 11, 2012 - Google Maps Library v0.1.7 - bug fixed: some memory leaks fixed (there is still some) (thanks Donovan) - Improvement: TGMCircle -> modified all Set and ShowElements methods to use the new method ChangeProperties inherited from TLinkedComponent - Improvement: GMFunctions -> added new functions of transformation types - Improvement: TGMGeoCode-> added boolean property PaintMarkerFound. To true, all markers are automatically generated (if a TGMMarker is linked) (by Luis Joaquin Sencion) - Improvement: TGMGeoCode-> generated URL is encoded in UTF8 to avoid problems with special characters (? accents, ....) - Improvement: TGMMap.TNonVisualProp -> added MapMarker property. True if Map Maker tiles should be used instead of regular tiles. - Improvement: TLatLngEvent -> the events of this type now have a new parametre, X and Y, of Real type, with information of point (X,Y) - Improvement: TLinkedComponent -> added ShowInfoWinMouseOver boolean property. If true, show the InfoWindows when mouse is over the object. Now
Delphi 7.1 Update Release Notes=======================================================This file contains important supplemental and late-breakinginformation that may not appear in the main productdocumentation, and supersedes information contained in otherdocuments, including previously installed release notes.Borland recommends that you read this file in its entirety.NOTE: If you are updating a localized version of Delphi 7, visit the Borland Registered User web site to obtain a localized readme file that may contain important late- breaking information not included in this readme file.IMPORTANT: Delphi must be closed before installing this update. =====================================================CONTENTS * INSTALLING THIS UPDATE * UPDATING LOCALIZED VERSIONS OF DELPHI 7 * KNOWN ISSUES * ISSUES ADDRESSED BY THIS UPDATE - IDE - CORE DATABASE - DATASNAP - DBGO (ADO COMPONENTS) - dbExpress - dbExpress COMPONENTS AND DB VCL - dbExpress CORE DRIVER AND METADATA - dbExpress VENDOR ISSUES - dbExpress CERTIFICATION - WEB SNAP - ACTIVEX - COMPILER - RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* This update can not be applied to Delphi 7 Architect Trial version. * This update can not be removed after it is installed.* You will need the original Delphi 7 installation CD available to install this update.* To install this update from the CD, insert the CD, and launch the d7_ent_upd1.exe file appropriate for your locale.* To install this update from the Web, double-click the self-executing installation file and follow the prompts. * The Delphi 7 documentation PDF files are available on the update CD.========================================================UPDATING LOCALIZED VERSIONS OF DELPHI 7* This update can be applied only to the English version of Delphi 7. There are separate updates for the German, French and Japanese ver
修改 姚乔锋 yaoqiaofeng@sohu.com修改的地方: 1.高亮当前行的方式,在自动换行的情况也只高亮一行 2.增强高亮当前的功能,可以选择于行号区显示指示器,可以选择当前行背景与前景 3.当行间距大于零时,原本文本会显示于靠上,现修改于垂直中间对齐 4.可以选择显示行间分隔线,增加可选择线的类型 5.当SynEdit位于MDI中的当前子窗口时,若是焦点转回到主窗口中某个控件后再转回来时会不能显示光标 6.当SynEdit第一列显示的字符是双字节字符的第二个字节时,在高亮当前行情况下会把第一个字节显示在行号区上 7.修改了DoCaseChange, 加快转换字母大小写的处理速度和精简代码,也避免出现一些双字节字符的丢失 8.对画右边线轻微修改,避免有时右边线颜色显示出错 9.修改了属性TEXT, 修正以前改变TEXT后不能UNDO的特性 10.(new) 增加可指定换行类型和换行列,但不能保证没有BUG 11.还有什么BUG请向我说声,谢谢!修改日期于2005.5.15----------以下为TCustomSynEdit类新增的属性---------- TCustomSynEdit = class property ActiveLine : TSynActiveLine; property Background: TColor; property Foreground: TColor; property Indicator : TSynGlyph; property Visible: boolean; property LineDivider : TSynLineDivider; property Visible : Boolean; property Color : TColor; property Style : TPenStyle; property RightEdge : TSynRightEdge; property Visible : Boolean; property Position : Integer; property Color : TColor; property Style : TPenStyle; property LineSpacing : integer; property LineSpacingRule : TLineSpacingRule; property BlockIndent : integer; property WordWrap : TSynWordWrap; property Enabled : Boolean; property Position : Integer; property Style : TSynWordWrapStyle; property Indicator : TSynGlyph; end;----------注:在修改增加自动换行的类型和可指定位置换行时,我遇到很多的困难,不论怎么修改总是存在BUG,于是就有一段时间跑去玩游戏,自到这几天重新研究代码时才把自动换行的那些BUG去掉,所以这个版本发布隔了比较久.

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧