Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Non Fullscreen dialog ????

8 views
Skip to first unread message

Gerd

unread,
Jul 27, 2002, 9:34:17 AM7/27/02
to
Dear PPC gurus,

Is there ANY way of creating a non-fullscreen dialog in the CF ??
(yes,yes, I know it's an "official" requirement, but.....)
I just would LOVE to write a dialog based app for my Ipaq that runs in, say,
a 140x80 dialog

thanks in advance to everyone who answers


hfr

unread,
Jul 27, 2002, 11:39:16 AM7/27/02
to
I had the same problem (wish): non full screen dialogs on PPC's and
cancel-button in dialogs....!!

The solution under eVC++ was simple:
1. set the CDialog::m_bFullScreen member to FALSE (in or OnInitDialog())
2. In WindowProc() return 0 if message==WM_SETTINGCHANGE (avoids that the
dialog is resized to full-screen again when showing/hiding the input panel
even if CDialog::m_bFullScreen was set to FALSE.

.NET Compact Framework:
At the moment I use only one non-full screen dialog in my .NET CF
application. I used p/Invoke to call a function in a MFC eVC++ DLL which
displays the non-full screen dialog for me (as described above)

I hope that there is a better way in future when a new .NET Compact
Framework is released.

Regards,
hfr

"Gerd" <m...@privacy.com> wrote in message
news:#K7jjHXNCHA.1996@tkmsftngp12...

James Trefry

unread,
Jul 27, 2002, 11:40:26 AM7/27/02
to
Try this.Size = ... in the form's constructor.


"Gerd" <m...@privacy.com> wrote in message
news:#K7jjHXNCHA.1996@tkmsftngp12...

hfr

unread,
Jul 27, 2002, 11:46:03 AM7/27/02
to
This is a read-only property!

You can set the size and position of controls and forms(!) using Width,
Height, Left and Bottom properties.

But under the .NET CF this has no affect on forms (but works on controls).
The form is always resized back to full screen. Maybe there is an event to
catch to avoid this.

Regards,
hfr


"James Trefry" <info....@devscapes.com> wrote in message
news:#KySwOYNCHA.2532@tkmsftngp10...

James Trefry

unread,
Jul 27, 2002, 12:51:49 PM7/27/02
to
I forgot to mention that the FormBorderStyle should be set to None.
Try this code in your form's constructor.
I have tested it in both the emulator and Pocket PC.
You don't get the blue title bar or a black border, but that would be easy
to create yourself.

//Change form size so it does not fill entire screen
this.FormBorderStyle = FormBorderStyle.None;
this.Location = new Point(10,30);
this.Size = new Size(220,250);

-James


"hfr" <harald-re...@gmx.at> wrote in message
news:eYRYHSYNCHA.2016@tkmsftngp08...

Dannie Johnson

unread,
Jul 27, 2002, 1:08:46 PM7/27/02
to
Hi,
Just saw this thread and just wanted to put my thoughts in.
I, too would really love to see a way to run a non fullscreen app in CF.
I'm sure one of you hardcore coders must know a way of doing this.
Failing that, maybe on of thr MS Code-Gods could give us a hint ?


"hfr" <harald-re...@gmx.at> wrote in message
news:eYRYHSYNCHA.2016@tkmsftngp08...

James Trefry

unread,
Jul 27, 2002, 2:22:23 PM7/27/02
to
Below is the complete form code for my humble implementation of a Pop Up
Dialog Box:
You can test it with this client code:

private void button1_Click(object sender, System.EventArgs e)
{
System.Windows.Forms.PopUpDialog dlg = new
System.Windows.Forms.PopUpDialog();
dlg.Text = "My PopUp Dialog Text";
dlg.ShowDialog();
MessageBox.Show(dlg.DialogResult.ToString());
dlg.Close();
dlg = null;
}

You can simply create a new form that inherits from this one, then easily
add a cancel button, or any other controls that you wish.
If you want an X instead of an OK, just edit the OKButton class.

Nothing prevents the user from clicking on the form behind it though and
canceling the dialog.
Perhaps someone has an idea for that?

Input and constructive criticism is not only welcome, but requested! That's
how we learn.

Thanks,

James Trefry
(see below)

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace System.Windows.Forms
{
/// <summary>
/// Summary description for PopUpDialog.
/// </summary>
public class PopUpDialog : System.Windows.Forms.Form
{
private System.Windows.Forms.Panel pnlTitleBar;
private System.Windows.Forms.Label lblFormTitle;
OKButton ok = new OKButton();

public PopUpDialog()
{
InitializeComponent();
transformPopUp();
}


#region "Implement Popup Dialog Window"
private void transformPopUp()
{


//Change form size so it does not fill entire screen
this.FormBorderStyle = FormBorderStyle.None;
this.Location = new Point(10,30);
this.Size = new Size(220,250);

//Adjust title bar label
pnlTitleBar.Width = this.Width;
lblFormTitle.Font = new Font("Tahoma", 9F, FontStyle.Bold);
lblFormTitle.ForeColor = Color.White;

//Add the ok button
ok.Location = new Point(pnlTitleBar.Width - 22, 4);
ok.Click += new System.EventHandler(this.ok_Click);
pnlTitleBar.Controls.Add(ok);
ok.BringToFront();
}
private void ok_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
pe.Graphics.DrawRectangle(new Pen(Color.Black), 0,0,this.Width - 1,
this.Height - 1);
}

public override string Text
{
get
{
return base.Text;
}
set
{
base.Text = value;
lblFormTitle.Text = value;
}
}

#endregion

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pnlTitleBar = new System.Windows.Forms.Panel();
this.lblFormTitle = new System.Windows.Forms.Label();
//
// pnlTitleBar
//
this.pnlTitleBar.BackColor = System.Drawing.Color.DarkBlue;
this.pnlTitleBar.Controls.Add(this.lblFormTitle);
this.pnlTitleBar.Size = new System.Drawing.Size(241, 26);
//
// lblFormTitle
//
this.lblFormTitle.Location = new System.Drawing.Point(4, 6);
this.lblFormTitle.Size = new System.Drawing.Size(135, 17);
this.lblFormTitle.Text = "Pop Up Dialog";
//
// PopUpDialog
//
this.ClientSize = new System.Drawing.Size(240, 295);
this.Controls.Add(this.pnlTitleBar);

}
#endregion
}

public class OKButton: Control
{
private bool isPressed = false;

public OKButton()
{
this.Size = new Size(17,17);
this.Font = new Font("Arial", 9F, FontStyle.Regular);
}
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);

this.BackColor = Color.DarkBlue;
if (isPressed)
{
pe.Graphics.DrawString("ok", new Font("Tahoma", 9F,FontStyle.Bold),new
SolidBrush(Color.White),1,1);
}
else
{
pe.Graphics.FillEllipse(new SolidBrush(Color.White),0,0,base.Width - 1,
base.Height - 1);
pe.Graphics.DrawString("ok", new Font("Tahoma", 9F,FontStyle.Bold),new
SolidBrush(Color.DarkBlue),1,1);
}
}
protected override void OnMouseDown(System.Windows.Forms.MouseEventArgs e)
{
isPressed = true;
this.Refresh();
}

protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e)
{
isPressed = false;
this.Refresh();
}
}
}

"Dannie Johnson" <DanJo...@yahoo.com> wrote in message
news:uryoI$YNCHA.2472@tkmsftngp12...

Chris Tacke, eMVP

unread,
Jul 27, 2002, 6:11:26 PM7/27/02
to
Out of curiosity, is this something forced by the Pocket PC platform? I've
done 95% of my development on a CE.NET device and the forms are never
full-screen unless I specifically make them that way. The behavior reported
seems to be something that the CF isn't imposing, but the Pocket PC Platform
itself.

-Chris


"Dannie Johnson" <DanJo...@yahoo.com> wrote in message
news:uryoI$YNCHA.2472@tkmsftngp12...

James Trefry

unread,
Jul 27, 2002, 9:51:25 PM7/27/02
to
"Some devices do not use the standard concept of dialog boxes. Instead,
dialog boxes appear as full-screen lists of controls, which scale more
easily than static dialog boxes and maximize legibility."

Source:
ms-help://MS.VSCC/MS.MSDNVS/ms.embeddedtoolssdk/evtuv/html/etconwindowsdialo
gboxes.htm

That's all I know about it.

-James


"Chris Tacke, eMVP" <cta...@innovativedss.com> wrote in message
news:O287TobNCHA.1724@tkmsftngp10...

hfr

unread,
Jul 28, 2002, 5:15:09 AM7/28/02
to
Looks good. Thanks!

"James Trefry" <info....@devscapes.com> wrote in message

news:eSCxq2YNCHA.2472@tkmsftngp12...

James Trefry

unread,
Jul 28, 2002, 12:30:39 PM7/28/02
to
Your welcome. But I must tell you that yesterday when I used this a code a
few times in a row, I had some problems with the form locking the entire
pocket pc. My dialog box had only one button and 2 radio buttons on it.
The only code I manually entered into the form was the 3 lines below. I
don't know if this is an issue with ShowDialog or if it's a slap on the hand
for not using a full screen form. Most times it works but if I keep
testing, it will always lock up within 10 tries on both my XScale and the
emulator.

Has anyone had similar problems?

I think I will refrain from using non-fullscreen forms for now, then see how
the RTM behaves.

I originally wanted something like a context menu to pop up at certain areas
of my screen, but with any controls I desire on it - not just menus.
Instead of a form I decided to inherit from Control and change the Visible
and Location properties as needed. This solution was not as clean though
and it lacks designer support.

Thanks,

-James


"hfr" <harald-re...@gmx.at> wrote in message

news:es8STchNCHA.1636@tkmsftngp12...

hfr

unread,
Jul 28, 2002, 4:23:32 PM7/28/02
to
So its good that I still use my non-fullscreen dialog written in eVC++ 3.0
and call it from my .NET CF application via P/Invoke ;-) (what shall C#
programmers do without interop and P/Invoke....;-)....)

Its just a generic dialog for input a single value: ShowInputDialog(LPCTSTR
lpTitle, LPCTSTR lpLabel, LPCTSTR lpValue, ...);

Another question: Are you satisfied with your XScale device? I am thinking
about to by the Fujitsu Siemens LOOX Pocket PC with an 400Mhz XScale CPU.

Best Regards,
hfr

PS: designer support for controls written for .NET Compact Framework!? I
thougt that this is not supported yet.

"James Trefry" <info....@devscapes.com> wrote in message

news:ehRcdPlNCHA.2680@tkmsftngp13...

James Trefry

unread,
Jul 28, 2002, 9:10:12 PM7/28/02
to

See inline.

"hfr" <harald-re...@gmx.at> wrote in message

news:#xt4wRnNCHA.1280@tkmsftngp13...


> So its good that I still use my non-fullscreen dialog written in eVC++ 3.0
> and call it from my .NET CF application via P/Invoke ;-) (what shall C#
> programmers do without interop and P/Invoke....;-)....)

Agreed. On both points.

> Its just a generic dialog for input a single value:
ShowInputDialog(LPCTSTR
> lpTitle, LPCTSTR lpLabel, LPCTSTR lpValue, ...);
>
> Another question: Are you satisfied with your XScale device? I am thinking
> about to by the Fujitsu Siemens LOOX Pocket PC with an 400Mhz XScale CPU.

I am testing with the Toshiba e740. I like everything about it except it
can't read text files. I posted earlier about the streamreader returning
junk. I kind of need that functionality for creating adhoc html files, then
opening them with PIE. I am rather emotionally attached to this device
though, so I am searching for another way to accomplish the same task
without adding additional dlls to my project. If you have an idea, it would
be much appreciated.

> Best Regards,
> hfr
>
> PS: designer support for controls written for .NET Compact Framework!? I
> thougt that this is not supported yet.

No, it's not supported, which is the major drawback of using a control
instead of a form.

Thanks,

-James

Steven Lasker

unread,
Aug 5, 2002, 12:44:00 PM8/5/02
to
There's actually two issues:
The NET CF Beta has a bug with ShowDialog. This will be fixed in a future
build.
On the form siziing, this is another infinit wisdom issue of the CE team.
Having nothting to do with the CF team. The CE Team beieves that all forms
should be full screen. This is why your form is always being maximized.
The CF Team is just following guidlines, all be them questionable. Changing
the border is a great work around. For this beta release, just don't use
the ShowDialog.

"Gerd" <m...@privacy.com> wrote in message
news:#K7jjHXNCHA.1996@tkmsftngp12...

0 new messages