Insert button in MDI.bas example in libwindow9 library

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
Tolo68
Posts: 105
Joined: Mar 30, 2020 18:18
Location: Spain

Insert button in MDI.bas example in libwindow9 library

Post by Tolo68 »

Hello everyone, I want to insert a button in one of the 2 forms inside the MDI window, but the button is placed in the MDI window, and not in "MDI1" or "MDI2"

This is the original code

#include once "window9.bi"

OpenWindow ("", 10,10,400,400)
ClientMDIGadget (MenuTitle (Create_Menu (), "MDI"), 100)
WindowColor (MDIGadget ("MDI1", 10,10,200,200), & h6405A3)
WindowColor (MDIGadget ("MDI2", 100,10,200,200), & h498721)

Do
var event = WaitEvent ()
If event = EventClose Then exit do
Loop

I want to insert a button in the window "MDI1"

Thank you
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Insert button in MDI.bas example in libwindow9 library

Post by VANYA »

I want to insert a button in the window "MDI1"
Example from help:

Code: Select all

#Include "window9.bi"
Dim As HWND mdi1,mdi2,clientmdi
Dim As HMENU hMessages,MenName
Dim As Integer event
OpenWindow("",10,10,400,400)
hMessages=Create_Menu()
MenName=MenuTitle(hMessages,"MDI")
clientmdi=ClientMDIGadget(0,0)
mdi1=MDIGadget("MDI1",10,10,200,200):WindowColor(mdi1,&h6405A3)
UseGadgetList(mdi1)
ButtonGadget(1,10,10,100,30,"Button")
UseGadgetList(clientmdi)
mdi2=MDIGadget("MDI2",100,10,200,200):WindowColor(mdi2,&h498721)

Do
   event=WaitEvent
   If event=EventClose Then
      If EventHwnd=mdi1 Then
         Close_Window(mdi1)
      ElseIf EventHwnd=mdi2 Then
         Close_Window(mdi2)
      Else
         end
      EndIf
   EndIf
   If event=eventgadget Then
      If EventNumber=1 Then
         end
      EndIf
   EndIf
Loop
In order to indicate which window at the moment you need to insert gadgets there is a function: UseGadgetList
Tolo68
Posts: 105
Joined: Mar 30, 2020 18:18
Location: Spain

Re: Insert button in MDI.bas example in libwindow9 library

Post by Tolo68 »

Thank you VANYA
I could already fix it.

A question.

In most examples of Window9, when a window is passed over the windows of Window9, they get scratched, and they do not repaint well, if you want I send you a photo.

Do you know why that is ???

Greetings.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Insert button in MDI.bas example in libwindow9 library

Post by VANYA »

Tolo68 wrote:Thank you VANYA
I could already fix it.

A question.

In most examples of Window9, when a window is passed over the windows of Window9, they get scratched, and they do not repaint well, if you want I send you a photo.

Do you know why that is ???

Greetings.
I hope you did not run the examples on a virtual system. (virtualbox , vmware ,...) ? Although I never had any problems even in a virtual system

Photography won't help. Please record the whole process on video (including the source code itself, compiling and running it). There are many programs for recording screen video.
Post Reply