Controls behave different in Window as in Dialog

Controls behave different in Window as in Dialog

Postby Marc Venken » Sat Feb 24, 2024 8:32 pm

I noticed that many controls behave different in Windows oWnd as dialogs oDlg. Why is that ?

Exact the same code, just this option :

Code: Select all  Expand view

if cRun = "Dialog"
  ACTIVATE DIALOG oMain CENTERED ;
  ON INIT ( oWebView := TWebView():New(), oWebView:SetHtml( Html() ), oWebView:SetParent( oPanel ) ) ;
  VALID ( oWebView:Terminate(), oWebView:Destroy(), .T. )
else
  ACTIVATE WINDOW oMain ON INIT OTimer:Activate() //;
      //ON PAINT oMain:DrawImage( "arduino2.jpg" ) CENTER
endif
 



If you ask what is the intention of this ? I'm preparing controls for a Robot dashboard and looking for controls that look nice )))

It seems that I best use a Dialog as Dashboard setup. AGree ??

WIndows :

Top left : Windows shows cam view, dialog not
Transparent on windows is much less in several options


Image

Dialog :

Image
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Controls behave different in Window as in Dialog

Postby Antonio Linares » Sat Feb 24, 2024 9:35 pm

Dear Marc,

Windows uses different code procedures to manage windows and dialogs, thus the differences.
We try to make them behave the same but there may be differences as the ones that you have spotted.

How are you showing the cam view ? Please post the code so we can review it, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Controls behave different in Window as in Dialog

Postby Marc Venken » Sat Feb 24, 2024 11:12 pm

It is code for testing :wink:

The webcam screen can be bigger, but it will always go to the left top position
The idea is to use a webcam/camera with USB on top of the Robotarm.
In case of Dialog, I get a error : Error Twebcam, Load driver error, Check webcam connection.
In case of Window it is shown.
At this moment the webcam is the buildin one from the laptop.

I can send you the testing program but it is all cut and past parts from the forum, but working like first post. Once cleaned it could be a interesting sample for the sample dir.
It runs now also from the sample dir with

buildh.bat I just needed to add 1 lib : echo %hdirl%\googlefwh.lib + >> b32.bc


Code: Select all  Expand view

#include "WebCam.ch"

Public oMain

//  The Dialog/Window testing is done because I can't get all controls transparent on dialog or window

if cRun = "Dialog"

DEFINE DIALOG oMain SIZE 1400,900 PIXEL TRUEPIXEL ;
  FONT oFont BRUSH oBrush ;
  TITLE "Dialog Robotic Arm : " + FWVERSION
else
  DEFINE WINDOW oMain FROM 50 , 100 TO 1000 , 1500 PIXEL TITLE "Window" BRUSH oBrush
endif

//  Code for all kind of code that you see above

RunWebcam(oMain)  //  oMain can be the  Dialog or Window like above

if cRun = "Dialog"
  ACTIVATE DIALOG oMain CENTERED ;
  ON INIT ( oWebView := TWebView():New(), oWebView:SetHtml( Html() ), oWebView:SetParent( oPanel ) ) ;
  VALID ( oWebView:Terminate(), oWebView:Destroy(), .T. )
else
  ACTIVATE WINDOW oMain ;
  ON INIT ( oWebView := TWebView():New(), oWebView:SetHtml( Html() ), oWebView:SetParent( oPanel ) ) ;
  VALID ( oWebView:Terminate(), oWebView:Destroy(), OTimer:Activate(), .T. )
endif


function runWebCam(oMain)
   Local oWebCam
   local hBmp
   @ 12, 45 WEBCAM oWebCam SIZE 75, 120 OF oMain START ADJUST RATE 66
   oWebCam:bLClicked = {|| MsgInfo( "Position can not be moved") }
Return Nil




 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1434
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Natter and 61 guests