Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Substitute of Msgbox (DialogForm)


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-11-2007, 11:27 AM
Newbie
 
Join Date: May 2007
Posts: 6
Default Substitute of Msgbox (DialogForm)

A simple way for user interaction is by the Msgbox function. However, this has some drawbacks as it allows only a certain button text (yes, no, OK, cancel..) and has a small button size.

In rough outside environments you may want the user not having to take the stylus (otherwise it is difficult to press the small buttons) but instead offer a simple full-screen dialog by way of a form having 2 (or some more) large buttons which can be pressed by hand, these buttons further having helpful information text.

I was not able to program such a dialog which should be as simple as the MsgBox feature and used the same way. In the example I have placed a MsgBox to show the current system. In the line ***** now marked as comments I have placed the desired sub call. But it appears there is no possibility to halt the program within DialogForm and wait for the button pressing event and then return the button number (e.g. as in MsgBox number 6 for the first and 7 for the second button) to the main program. I am aware that there are other ways to handle the problem for a specific case simply by putting the "If BtnPressed=6 Then" part from App_Start to Btn_Click but I am looking for a way to use such MsgBox-substitutes in more places so it must be generalized.
Can anyone help me?
Attached Files
File Type: sbp DialogForm.sbp (1.9 KB, 15 views)
Reply With Quote
  #2 (permalink)  
Old 12-11-2007, 02:01 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 516
Awards Showcase
Competition Winner 
Total Awards: 1
Default

Hello miklquick
Try the program below, I think it is what you are looking for.
Of course there are different ways to program it, this is one.
You can adapt it to your application

The return value of first button in the MsgBox is not 6.
The 6 means that the 'Yes' button was pressed, this is only valid if you select cMsgBoxYesNo or cMsgBoxYesNoCancel.
With the MsgBox you should better use the constats cYes, cNo etc.
If you select for example cMsgBoxAbortRetryIgnore the return value of the first button will be cAbort = 3

I hope this helps you, best regards

Klaus
Switzerland
Attached Files
File Type: sbp DialogFormNew.sbp (3.7 KB, 26 views)
Reply With Quote
  #3 (permalink)  
Old 12-11-2007, 02:30 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 2,849
Default

I've attached a small program that uses CallSub method to return to the right place.
The call to ShowDialog should be the last statement in the current sub.
Attached Files
File Type: sbp Dialog.sbp (1.4 KB, 32 views)
Reply With Quote
  #4 (permalink)  
Old 12-12-2007, 05:29 AM
Newbie
 
Join Date: May 2007
Posts: 6
Default


Thank you Klaus and Erel for your quick replies. Both solutions enable a general DialogForm.

Klaus: Your do-loop (lines 73-75) was the inspiration which I didnīt have. Thanks a lot. I now enclose my final version of what I was looking for which is based on your idea.

One essential point for me was the possiblity to use DialogForm just as simple as MsgBox, namely within a subroutine (i.e. that execution of the program continues in the same sub !) and the possibility to evaluate the Dialog result with an If..Then block. This is now possible.

Erel: Thanks too. The only drawback is that as result of the dialog you do not get back to the calling sub but you branch off into alternative subs which I wanted to avoid.

Miklquick
Attached Files
File Type: sbp DialogForm1.sbp (1.8 KB, 17 views)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Msgbox Question cdeane Questions & Help Needed 2 05-04-2008 09:23 PM
Msgbox issue? badkarma Bug Reports 2 04-12-2008 10:39 AM
MsgBox does not work? skipper Bug Reports 2 01-05-2008 09:28 AM
Msgbox Vito Questions & Help Needed 2 11-19-2007 08:05 AM
Application does not end until msgbox is closed Mistrel Bug Reports 0 10-13-2007 06:26 AM


All times are GMT. The time now is 07:25 PM.


Powered by vBulletin® Version 3.6.10
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0