* *

Coding

Welcome, Guest. Please login or register.
Did you miss your activation email?
December 16, 2017, 04:11:23 AM

Login with username, password and session length

Menu

Members
Stats
  • Total Posts: 12183
  • Total Topics: 1737
  • Online Today: 40
  • Online Ever: 195
  • (February 11, 2014, 01:46:08 PM)
Users Online
Users: 1
Guests: 29
Total: 35
King64
Yahoo!
Sogou
Google
Baidu (2)

Author Topic: Window not waiting for a response  (Read 2248 times)

0 Members and 1 Guest are viewing this topic.

Offline PK

  • Newbie
  • *
  • Posts: 13
  • Bananas: 0
  • Gender: Male
  • I haven't set any personal text yet
Window not waiting for a response
« on: September 11, 2013, 12:25:38 AM »
$INCLUDE "TestGlobals.eba"
GLOBAL SUB TestDrawExtraMaterialsScreen(),INT
AUTODEFINE "OFF"
   OPENWINDOW AdditionalMaterials,350,0,400,500,@SIZE|@MINBOX|@MAXBOX,0,"Extra Materials",&AdditionalMaterialsMain
   CONTROL AdditionalMaterials,@BUTTON,"Finished",50,400,80,20,@TABSTOP|@CTLBTNDEFAULT,996
   CONTROL AdditionalMaterials,@LISTBOX,"Materials",100,50,150,300,@CTLISTNOTIFY|@VSCROLL,997
   Index2 = 0
   FOR Index = 1 to ExtraMaterialsCount
      INSERTSTRING AdditionalMaterials,997,Index2,ExtraMaterials[Index2]
      Index2 = Index2 + 1
   NEXT Index
RETURN 0
ENDSUB

GLOBAL SUB AdditionalMaterialsMain(),INT
AUTODEFINE "OFF"
   SELECT @MESSAGE
      CASE @IDCREATE
         CENTERWINDOW AdditionalMaterials
      CASE @IDCLOSEWINDOW
         CLOSEWINDOW AdditionalMaterials
      CASE @iDCONTROL
         SELECT @CONTROLID
            CASE 996
               SelectedMaterial = GETSELECTED AdditionalMaterials,996
               CLOSEWINDOW AdditionalMaterials
      ENDSELECT
   ENDSELECT
RETURN 0
ENDSUB

When this routine is run it produces the required output but returns to the calling routine without waiting for the Finished button.


Offline Larry McCaughn

  • Head Monkey
  • Administrator
  • Sr. Member
  • *****
  • Posts: 259
  • Bananas: 4
  • Gender: Male
Re: Window not waiting for a response
« Reply #1 on: September 11, 2013, 01:45:43 AM »
This portion of your code:
CASE @iDCONTROL
   SELECT @CONTROLID
      CASE 996
         SelectedMaterial = GETSELECTED AdditionalMaterials,996
         CLOSEWINDOW AdditionalMaterials
needs to be changed to this
CASE @iDCONTROL
   SELECT @CONTROLID
      CASE 996
         If @notifycode=0
            SelectedMaterial = GETSELECTED AdditionalMaterials,997
            CLOSEWINDOW AdditionalMaterials
         endif
 
Admin - Here and @ Ionic Wind Software Forums
Author of Custom Button Designer, Custom Chart Designer, Snippet Manager, and IWB+ (A Visual Designer for IWBasic 2.x/3.x)

Offline PK

  • Newbie
  • *
  • Posts: 13
  • Bananas: 0
  • Gender: Male
  • I haven't set any personal text yet
Re: Window not waiting for a response
« Reply #2 on: September 11, 2013, 05:20:19 AM »
Thanks for the quick reply.

Offline PK

  • Newbie
  • *
  • Posts: 13
  • Bananas: 0
  • Gender: Male
  • I haven't set any personal text yet
Re: Window not waiting for a response
« Reply #3 on: September 11, 2013, 07:59:58 PM »
I tried your suggestion but unfortunately it did not work.

$INCLUDE "TestGlobals.eba"
GLOBAL SUB TestDrawExtraMaterialsScreen(),INT
AUTODEFINE "OFF"
   OPENWINDOW AdditionalMaterials,350,0,400,500,@SIZE|@MINBOX|@MAXBOX,0,"Extra Materials",&AdditionalMaterialsMain
   CONTROL AdditionalMaterials,@BUTTON,"Finished",50,400,80,20,@TABSTOP|@CTLBTNDEFAULT,996
   CONTROL AdditionalMaterials,@LISTBOX,"Materials",100,50,150,300,@CTLISTNOTIFY|@VSCROLL,997
   Index2 = 0
   FOR Index = 1 to ExtraMaterialsCount
      INSERTSTRING AdditionalMaterials,997,Index2,ExtraMaterials[Index2]
      Index2 = Index2 + 1
   NEXT Index
RETURN 0
ENDSUB

GLOBAL SUB AdditionalMaterialsMain(),INT
AUTODEFINE "OFF"
   SELECT @MESSAGE
      CASE @IDCREATE
         CENTERWINDOW AdditionalMaterials
      CASE @IDCLOSEWINDOW
         CLOSEWINDOW AdditionalMaterials
      CASE @iDCONTROL
         SELECT @CONTROLID
            CASE 996
               IF @notifycode = 0
                  SelectedMaterial = GETSELECTED AdditionalMaterials,997
                  CLOSEWINDOW AdditionalMaterials
               ENDIF
      ENDSELECT
   ENDSELECT
RETURN 0
ENDSUB

Offline Larry McCaughn

  • Head Monkey
  • Administrator
  • Sr. Member
  • *****
  • Posts: 259
  • Bananas: 4
  • Gender: Male
Re: Window not waiting for a response
« Reply #4 on: September 11, 2013, 08:53:44 PM »
Quote
I tried your suggestion but unfortunately it did not work.
define "...it did not work"
Admin - Here and @ Ionic Wind Software Forums
Author of Custom Button Designer, Custom Chart Designer, Snippet Manager, and IWB+ (A Visual Designer for IWBasic 2.x/3.x)

Offline PK

  • Newbie
  • *
  • Posts: 13
  • Bananas: 0
  • Gender: Male
  • I haven't set any personal text yet
Re: Window not waiting for a response
« Reply #5 on: September 12, 2013, 12:13:30 AM »
It still returned to the calling routine without waiting for a response.

Offline Larry McCaughn

  • Head Monkey
  • Administrator
  • Sr. Member
  • *****
  • Posts: 259
  • Bananas: 4
  • Gender: Male
Re: Window not waiting for a response
« Reply #6 on: September 12, 2013, 01:53:57 AM »
This code, using what I showed you, demonstrates that the code I showed you works properly:
Code: [Select]
def main, AdditionalMaterials:window
def ExtraMaterialsCount:int
def ExtraMaterials[5]:string
  ExtraMaterials[0]="Item 1"
  ExtraMaterials[1]="Item 2"
  ExtraMaterials[2]="Item 3"
  ExtraMaterials[3]="Item 4"
  ExtraMaterials[4]="Item 5"
 ExtraMaterialsCount=5
 OPENWINDOW
main,0,0,700,600,@CAPTION|@MAXBOX|@MINBOX|@SIZE|@SYSMENU,0,"Form1",&main_handler
 CONTROL main,@SYSBUTTON,"open",20,20,60,25,0,101
 CENTERWINDOW main
 run=1
 waituntil run=0
 closewindow main
 end
 
SUB main_handler(),INT
 SELECT @MESSAGE
  CASE
@IDCLOSEWINDOW
   run=0
  case @idcontrol
   SELECT @controlid
    CASE 101
     IF @NOTIFYCODE=0
      TestDrawExtraMaterialsScreen()
     ENDIF
   ENDSELECT
 
 ENDSELECT
 RETURN 0
ENDSUB

GLOBAL SUB TestDrawExtraMaterialsScreen(),INT
   OPENWINDOW AdditionalMaterials,350,0,400,500,@SIZE|@MINBOX|@MAXBOX,main,"Extra
Materials",&AdditionalMaterialsMain
   CONTROL
AdditionalMaterials,@BUTTON,"Finished",50,400,80,20,@TABSTOP|@CTLBTNDEFAULT,996
   
CONTROL
AdditionalMaterials,@LISTBOX,"Materials",100,50,150,300,@CTLISTNOTIFY|@VSCROLL,997
   
FOR Index = 0 to ExtraMaterialsCount-1
      INSERTSTRING AdditionalMaterials,997,Index,ExtraMaterials[Index]
   NEXT Index
RETURN 0
ENDSUB
GLOBAL SUB AdditionalMaterialsMain(),INT
   SELECT @MESSAGE
      CASE @IDCREATE
         CENTERWINDOW AdditionalMaterials
      CASE @IDCLOSEWINDOW
         CLOSEWINDOW AdditionalMaterials
      CASE @iDCONTROL
         SELECT @CONTROLID
            CASE 996
               IF @notifycode = 0
                  SelectedMaterial = GETSELECTED AdditionalMaterials,997                 
                  CLOSEWINDOW AdditionalMaterials
               ENDIF
      ENDSELECT
   ENDSELECT
RETURN 0
ENDSUB
But you've got other problems with your structure
You are using an independent window  (main in my example) to open another independent window. That means you can open the AdditionalMaterials window, leave it open and go back to the main window and open another copy of the AdditionalMaterials windows.  You can even close the main window with the AdditionalMaterials window(s) still open.
 
In order to solve that problem you need to make AdditionalMaterials a child of the main window.
You do that by adding main as the parent parameter on the openwindow AdditionalMaterials line as I have done in the above example.  But that doesn't solve your problems.  A child window cannot be display outside the client area of the parent.  Also you can still have AdditionalMaterials open and click the button in main and open another copy of AdditionalMaterials.
Now, if instead of AdditionalMaterials being a window you make it a dialog and create it with the CREATEDIALOG command it solves a bunch of these problems:
you only need to create the dialog once when your program is starting up since creating it is separate from displaying it.
When you want to display it you can do it with the DOMODAL command.
It  can be displayed anywhere on the screen and can be larger than its parent.
It locks you out of the main until the dialog is closed.
 
Now it does create problems of its own.  creating control's are handled in one place and initializing those controls (font,color,contents,etc) are handled in a different place.
 
It appears from your postings (this and earlier) that this is all new to you.  I suggest you spend some significant time reading through the WINDOWS section and subsections of the help file. It doesn't appear that your skillset is at the level to tackle this complicated of a project.
 
In the future, in order to get help you really need to put your entire project(eba,inc,ebp files and any other support files(bmps,data files,etc) that your project uses in a zip file and attach it to your post. And you will need to be specific in describing what your problem is.
Other wise I won't be able to spend the time trying to guess what you are trying to accomplish and how you got to the code that you post.
 
Hope this helps.
 
Admin - Here and @ Ionic Wind Software Forums
Author of Custom Button Designer, Custom Chart Designer, Snippet Manager, and IWB+ (A Visual Designer for IWBasic 2.x/3.x)

 

To link to us use this code/button on your site

http://www.codingmonkeys.com/images/cm_link.gif

ShoutBox!

 

Blue Steel

December 09, 2017, 02:46:53 AM
:) ty fingers crossed
 

Larry McCaughn

December 08, 2017, 04:10:56 PM
I'll give you a Shout out in the Shout Box for being able to put it back up.
 

lurkalot

September 20, 2017, 01:57:54 PM
Hey that's my job. Didn't choose this username for nothing you know.  :)
 

Larry McCaughn

September 19, 2017, 12:24:13 AM
lurking in the shadows, lurkalot.
 

lurkalot

September 16, 2017, 04:39:43 PM
Good evening all.  Where is everyone?
 

lurkalot

September 12, 2017, 12:57:36 PM
Good to hear, it's nice to see a empty error log. ;)
 

Blue Steel

September 12, 2017, 05:04:25 AM
running sites log files overnight heres the result (I know mainly spiners) "There are currently no error log entries." :)
 

lurkalot

September 12, 2017, 03:19:33 AM
Morning all.  :)
 

Blue Steel

September 12, 2017, 01:12:33 AM
Let it all out ..
these are the things I can't do without  ;)

MikeHart

September 11, 2017, 11:14:22 PM
SHOUT SHOUT  :)
 

GWS

September 11, 2017, 08:16:02 PM
Shouting is Go !  ;D
 

Blue Steel

September 11, 2017, 06:54:02 PM
gradually getting there
 

lurkalot

September 11, 2017, 05:22:46 PM
Yay, you found it.  ;)
 

Larry McCaughn

September 11, 2017, 01:07:13 PM
looks like you're making good progress
 

Blue Steel

September 07, 2017, 10:34:19 PM
yay recent topics are working again in the center of the home page :)
 

Larry McCaughn

July 12, 2017, 05:46:33 PM
Blue Steel is back running the show.  Maybe he'll be able to build some steam in the ole place!
 

Blue Steel

June 26, 2017, 04:58:41 AM
hope i didn't scare too many of you
 

Blue Steel

June 26, 2017, 04:58:12 AM
Boo, i'm still here alive and well , see my post in introductions

MikeHart

July 25, 2016, 01:43:24 AM
That sounds cool. Have to chekc out IWBasic in the next days.
 

Larry McCaughn

July 22, 2016, 11:47:00 PM
I'm hoping to issue a new maintenance release to the IWBasic 3.x IDE in the next few weeks and Larry Sikes has released an update to the Linux version of IWBasic and is currently working on the 64bit version of IWBasic.  Progress should speed up since he has retired and has apparently resolved his m

MikeHart

July 19, 2016, 02:53:02 PM
Anything interesting going on around BASIC?
 

Larry McCaughn

July 18, 2016, 09:14:12 AM
Hello Mike

MikeHart

July 16, 2016, 04:33:25 PM
Hi there all!
 

pistol350

June 24, 2016, 03:41:10 AM
Hello all!
I'm still around although less active!