Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Return value from Form

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-26-2007, 08:44 AM
Newbie
 
Join Date: Jun 2007
Posts: 4
Default Return value from Form

I created a form [say: Selection-form] which will be used several times to select something. How do I stop my program - wait until the Selection-form is completed - and use the result?

Something like:

result = SelectionForm.GetSomething
' wait until something is selected
txtResult.text = result


Anybody know?
Thanks - Ghislain
Reply With Quote
  #2 (permalink)  
Old 06-26-2007, 08:53 AM
Senior Member
 
Join Date: Apr 2007
Location: Copenhagen
Posts: 173
Default

The way I would do it is to just use the selectionform.show when you want to to get the information and include an "Ok" and a "Cancel" button on the form:

Sub btnOk_click
result=txtSelection.text
selectionform.close
end sub

Sub btnCancel_click
selectionform.close
end sub

But I am sure there are more elegant solutions around

all the best / Björn
Reply With Quote
  #3 (permalink)  
Old 06-26-2007, 12:18 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Ghislain,

There are many ways to acheive what you want.
BjornF has suggested a good event based way of doing this.
You could also use a Do Until/Do While command or If Then to loop back through the code until your value has changed.

Have you checked out Erel's Input Panel which can be found here http://www.basic4ppc.com/forum/code-samples-tips/108-input-panel.html
You might be able to adapt this to fit your needs.

Regards,
Randomcoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #4 (permalink)  
Old 06-26-2007, 01:08 PM
Newbie
 
Join Date: Jun 2007
Posts: 4
Default

Hello again!

BjornF,
Your solutions seems logical and i have tried it.
But - as soon as you call formSelection.show the program continues and the return value from btnClick_OK will never be captured..

RandomCoder
Thanks. I hope i will find a solution which works with forms in the future. But the panel will do the trick for the time being..
Thinking about it - it won't work. The input-panel example doesn't return a value either..

Bummer!
I guess a while-wend loop is the only option. It seems quite processor intense to me. I hope there is a better solution. It should be possible - eg: calendar-control & open-dialog.

Ghislain
Reply With Quote
  #5 (permalink)  
Old 06-26-2007, 01:14 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

I don't recommend you to use a waiting loop.
A better approach will be similar to BjornF solution:
Code:
Sub Sub1
 ...
 frmOptions.Show 
'the dialog form
End Sub

Sub frmOptions_Close
 result = textbox1.text
 Sub2
End Sub

Sub Sub2
 ... 
'Continue your program
End Sub
Reply With Quote
  #6 (permalink)  
Old 12-23-2007, 07:34 AM
Newbie
 
Join Date: Dec 2007
Posts: 3
Default

What we need is to add modal/modeless to the Show method of the form, so:

Form2.Show 0 will work as ususal (Form2 shows but the code continues after to executre after Form2.Show)

but,

Form2.Show 1 will show Form2 and waits until Form2 is closed (btw: how about a "REAL" close?)
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
return codes of a shell command pmu5757 Questions (Windows Mobile) 18 06-15-2008 07:33 PM
Can a sub return more than 1 value ? TWELVE Questions (Windows Mobile) 13 05-28-2008 09:58 AM
All hail GeoTrail's return RandomCoder Chit Chat 1 02-17-2008 12:14 PM
return issue Cableguy Questions (Windows Mobile) 1 09-21-2007 06:01 AM


All times are GMT. The time now is 04:35 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0