#89234 - 2002-11-06 03:21 PM
Re: KiXforms - Version 2.1.2 (Build 36) Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
One should be able to place a PictureBox in a frame, I just ran a modified version of the above script with these amendments:
code:
$prgStatus = $fraStatus.PictureBox $prgStatus.BackColor = IndianRed $prgStatus.BorderStyle = 2
Seemed to work ok ... We definitely need a new and improved FRAME for Kixforms ... think we already discussed this refreshing issue in the past. j, might want to verify your issue by "wiping" other windows over your form. Or by minimizing then maximizing the form.
|
Top
|
|
|
|
#89238 - 2002-11-06 04:42 PM
Re: KiXforms - Version 2.1.2 (Build 36) Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Well, I will give some background in terms of what the problem is. The problem is that I'm trying to support two different ways of showing child controls in a frame.
1) Some folks create controls that are children of the form, then use a frame to visually group the controls. In this case, the frame must be totally transparent so that the child controls can be seen. If the frame is moved, the child controls do not move with. Plus, RadioButtons that are grouped this way are not mutually exclusive by default.
2) Other folks create controls that are children for the frame. In this scenario, the frame doesn't have to be transparent and if the frame is moved, the child controls move with it. RadioButons grouped in this fashion are mutually exclusive by default.
The second option is actually the one I had in mind for proper usage of a frame. If you actually look at VB .FRM statements, child controls "appear" to be children of the frame, and not the form. They seem to be created in a nested fashion.
So what I did, when I created Kixforms v2, was to make the frame non-transparent. The refreshing issue as we see it now, was not a problem. Plus, one could actually set the BackColor of a frame if one wanted. But - when I went back over some legacy scripts that I had - found some scripts that did things "the other way" and the frame hid all the controls underneath.
So caught between a rock and a hard-place right now. Its important to realize that BOTH methods are correct. For example in regular C++ dialogs, the child controls placed in a frame are not children of the frame, they are owned by the dialogbox itself. The frame is just used for visual grouping. The difference is that one doesn't noramally see controls appear and vanish on the fly - plus, C++ dialogs are statically declared and built before they are shown - with Kixforms and Kixtart scripting - the controls are built on the fly - thus we sometimes see them move and flash in certain circumstances. Thats why we usually defer showing the form until just before the DoEvents loop - to keep things hidden until the form is fully rendered.
To change the FRAME behavior this late in the game might be a mistake. The other option you might want to explore is to use the PictureBox object - which can also act as a container. To be honest - the PictureBox object is a FORM ... diff being that its owned by the parent form - its really a borderless sub-form. It has a persistent bitmap background just like a regular form, and can host child controls.
The next best option is to explore a new type of container control - which I've already started to do. dotnet has an object called a "PANE" with behave very much like a frame (its the dotnet version of a frame - its also called a GROUPBOX in some other circles) - the discussion will really center around whether this new control wil REQUIRE that the contained controls be created as children of the pane. My take is that this should be a requirement. [ 06. November 2002, 16:43: Message edited by: Shawn ]
|
Top
|
|
|
|
#89240 - 2002-11-06 06:02 PM
Re: KiXforms - Version 2.1.2 (Build 36) Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
yeah, i always use the frame child thingy to - mostly because I always end up moving and adjusting and tweaking the form afterwards, its a whole lot easier to just re-position the frame, then have to re-calculate all the child controls as well. here's the picturebox version of the script. it would simulate (pretty closely) how a dotnet pane object would behave (except for the etched border and caption, which isn't there) - but you could draw your own if you wanted ...
HEY Wiz - How about getting a little splash of color in those forms of yours, eh ? I always get much high praise from Jochen for my splendid use of color - right J ?
code:
Break On $frmMain = CreateObject("Kixtart.Form") $frmMain.Size = 400,200 $frmMain.SysMenu = 0 $frmMain.Text = "Welcome to the @DOMAIN Domain" $frmMain.Center $frmMain.BackColor = MediumAquaMarine $fraStatus = $frmMain.PictureBox $fraStatus.BackColor = IndianRed $fraStatus.Location = 10,10 $fraStatus.Right = $frmMain.ClientWidth - 10 $fraStatus.Bottom = 0.70 * $frmMain.ClientHeight - 10 $fraStatus.Text = " Progress " $prgStatus = $fraStatus.ProgressBar $prgStatus.BackColor = Khaki $prgStatus.ForeColor = $frmMain.BackColor $prgStatus.BorderStyle = 2 $prgStatus.Size = 260, 17 $prgStatus.Center $prgStatus.Style = 1 $prgStatus.Top = 40 $btnDo = $frmMain.Button $btnDo.Text = "Do" $btnDo.OnClick = "btnDo_Click" $btnDo.Center $btnDo.Top = $fraStatus.Bottom + 10 Function btnDo_Click $prgStatus.Visible = Not $prgStatus.Visible If $prgStatus.Visible For $i = 0 to $prgStatus.Max $prgStatus.Value = $i Sleep 0.010 Next $prgStatus.Value = 0 EndIf EndFunction $frmMain.Center $frmMain.Show While $frmMain.Visible $=Execute($frmMain.DoEvents) Loop
|
Top
|
|
|
|
#89241 - 2002-11-06 06:14 PM
Re: KiXforms - Version 2.1.2 (Build 36) Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Plus don't forget, there is a whole suite of powerfull graphic functions built into Kixforms for desiging custom controls, fe. don't like how the frame object looks - just design your own using the generic PictureBox control with a custom paint job :
code:
Break On $frmMain = CreateObject("Kixtart.Form") $frmMain.Size = 400,200 $frmMain.SysMenu = 0 $frmMain.Text = "Welcome to the @DOMAIN Domain" $frmMain.Center $frmMain.BackColor = MediumAquaMarine $fraStatus = $frmMain.PictureBox $fraStatus.BackColor = $frmMain.BackColor $fraStatus.BorderStyle = 0 $fraStatus.Location = 10,10 $fraStatus.Right = $frmMain.ClientWidth - 10 $fraStatus.Bottom = 0.70 * $frmMain.ClientHeight - 10 $fraStatus.ForeColor = DarkGreen $fraStatus.FontBold = 1 $fraStatus.Rectangle(0,7,$fraStatus.ClientWidth-7,$fraStatus.ClientHeight-7) $fraStatus.ForeColor = Blue $fraStatus.FontTransparent = False $fraStatus.PrintXY(5,0," Caption ") $prgStatus = $fraStatus.ProgressBar $prgStatus.BackColor = Khaki $prgStatus.ForeColor = $fraStatus.ForeColor $prgStatus.BorderStyle = 2 $prgStatus.Size = 260, 17 $prgStatus.Center $prgStatus.Top = 40 $btnDo = $frmMain.Button $btnDo.Text = "Do" $btnDo.OnClick = "btnDo_Click" $btnDo.Center $btnDo.Top = $fraStatus.Bottom + 10 Function btnDo_Click For $i = 0 to $prgStatus.Max $prgStatus.Value = $i Sleep 0.010 Next $prgStatus.Value = 0 EndFunction $frmMain.Center $frmMain.Show While $frmMain.Visible $=Execute($frmMain.DoEvents) Loop
[ 06. November 2002, 18:15: Message edited by: Shawn ]
|
Top
|
|
|
|
#89242 - 2002-11-06 06:41 PM
Re: KiXforms - Version 2.1.2 (Build 36) Released
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
And - if I may be so bold - I think the script that opitimizes the power of a custom paint job is in the yet unpublished (but infamous) RatProgressBar created by one NTDOC (aka Ron). Hopefully, if he reads this far, he will correct this oversight on his part.
|
Top
|
|
|
|
#89244 - 2002-11-07 04:02 AM
Re: KiXforms - Version 2.1.2 (Build 36) Released
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11623
Loc: CA
|
Here is the RatProgressBar Shawn was speaking of.
code:
Break On $Form = CreateObject("Kixtart.Form") $Form.ScaleWidth = 300 $Form.ScaleHeight = 200 $Form.FontSize = 12 $Form.BackColor = 128,128,255 $Form.ForeColor = 0,0,255 $Form.FillColor = $Form.ForeColor $Form.FillStyle = 1 $Form.Circle(26,30,40) ;$Form.Rectangle(27,10,110,40) $Form.Circle(133,30,40) $Form.Circle(80,80,50) $Form.ForeColor = 255,255,255 $Form.FontName = "Comic Sans MS" $Form.FontSize = 24 $Form.FontBold = 1 $Form.PrintXY(25,25,"Mickey") $Form.FontSize = 12 $Form.FontBold = 0
$PBar = $Form.ProgressBar $PBar.Size = 280,30 $PBar.Location = 10,140 $PBar.Max = 100 $PBar.Value = 50 $PBar.ForeColor = 150,255,150 $Form.Center $Form.Show While $Form.Visible $=Execute($Form.DoEvents) Loop Exit 1
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 262 anonymous users online.
|
|
|