[Gambas-user] Embedding another application

M0E Lnx m0e.lnx at ...626...
Wed Jul 9 23:50:31 CEST 2008


Thanks.. I figued something like that needed to be done shortly after asking.

Here is what I did


DIM sTitle AS String
  DIM aHandle AS NEW Pointer[]
  DIM iHandle AS Integer
  DIM i AS Integer = 0

  FrmDiskPart.tlBanner.Text = "<h3>Loading gparted .... Please wait</h3>"
  SHELL "sudo /usr/sbin/gparted"
  WAIT 3

  sTitle = "GParted"
  IF Left(sTitle, 2) = "0x" THEN
    iHandle = Val("&" & Mid$(sTitle, 3))
  ELSE IF Left(sTitle) = "&" THEN
    iHandle = Val(sTitle)
  ELSE
    aHandle = Desktop.Find(sTitle)
    IF aHandle.Count = 0 THEN
      REPEAT
        WAIT
        aHandle = Desktop.Find(sTitle)
        INC i
      UNTIL
      i = 3 OR aHandle.Count > 0
        IF aHandle.Count = 0 THEN
          Message("Cannot find GParted.")
        RETURN
        END IF

    ELSE IF aHandle.Count >= 2 THEN
      Message("Several windows found. I take the first one!")
    ENDIF
    iHandle = aHandle[0]

  ENDIF

  'TRY embEmbedder.Embed(iHandle)
  TRY FrmDiskPart.EmbGPARTED.Embed(iHandle)

  IF ERROR THEN Message.Warning(Error.Text)


I took a lot of this code from the embedder example...
but it works fine... thank you




On Wed, Jul 9, 2008 at 4:26 PM, Benoit Minisini
<gambas at ...1...> wrote:
> On mercredi 09 juillet 2008, M0E Lnx wrote:
>> Hi again, Another small annoyance in my endeavours to use the embedder
>> object
>>
>> I am trying to embed an application into my form using the embedder object.
>> The embedding works fine (thanks to the bugfixes :=] ) but here is the
>> little annoyance
>>
>> To be more specific, I'm trying to embed gparted into my form.
>> As you may or may not know, gparted takes a few seconds to load. This
>> is because it scans the system for drives and stuff, so there is a
>> delay from the fime the SHELL command is executed and the time the
>> application really shows up on the desktop
>>
>> This is a problem for me (at least now) because my embedder is looking
>> for the application, and sometimes it times out
>>
>> so I need help ... I need a way to make my sub WAIT just enough to let
>> gparted load
>> I can't use the WAIT argument on the SHELL like, because then it'll
>> never get embedded
>>
>> any ideas how I might accomplish this?
>>
>
> Just wait with the WAIT instruction.
>
> Then check that the window of gparted is on the screen with Desktop.Find()
>
> If it is not, wait again.
>
> Check that gparted didn't die with the Process_Kill event.
>
> Regards,
>
> --
> Benoit Minisini
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




More information about the User mailing list