POPUP window size

POPUP window size

Postby Natter » Sat Apr 08, 2023 11:15 am

Hi,

I need to make a Popup window with the ability to resize it
Code: Select all  Expand view
#define WS_SIZEBOX 0x00040000L

    DEFINE DIALOG oFrg FROM 0,0 TO 0,0  PIXEL ;
           STYLE nOR(WS_POPUP, WS_SIZEBOX)  COLOR CLR_BLACK, CLR_WHITE

    ACTIVATE DIALOG oFrg  NOWAIT

It turned out, but partially - I can change the size of the window only on the left and top :(
Natter
 
Posts: 1211
Joined: Mon May 14, 2007 9:49 am

Re: POPUP window size

Postby karinha » Sat Apr 08, 2023 2:01 pm

Algo asi?

Code: Select all  Expand view

// C:\FWH\SAMPLES\SILVPREV.PRG

#include "FiveWin.ch"
#include "constant.ch"

#define AS_MDICHILD  1
#define AS_DIALOG    2
#define WS_SIZEBOX 0x00040000L

STATIC oWnd

FUNCTION Main()

   DEFINE WINDOW oWnd TITLE "Test" MDI MENU BuildMenu()

   SET MESSAGE OF oWnd TO "test" CENTER NOINSET  2015

   ACTIVATE WINDOW oWnd

RETURN NIL

FUNCTION BuildMenu()

   LOCAL oMenu

   MENU oMenu 2015

      MENUITEM "Test"

      MENU
         MENUITEM "test" ACTION Previsioni()
      ENDMENU

      oMenu:AddMdi()

   ENDMENU

RETURN( oMenu )

FUNCTION Previsioni()

   LOCAL oDlg, oBar, oFont, oBrw, N
   LOCAL nBottom   := 44
   LOCAL nRight    := 110
   LOCAL nWidth :=  Max( nRight * DLG_CHARPIX_W, 180 )
   LOCAL nHeight := nBottom * DLG_CHARPIX_H
   LOCAL nClrText := CLR_BLACK
   LOCAL oGrp := Array( 2 )
   LOCAL cTitle := "Previsioni"
   LOCAL oProgress
   LOCAL oPrevisione
   LOCAL dprimadata, ntotali_records, primo
   LOCAL oItem1, oItem2
   LOCAL aData := {}
   LOCAL oPanel
   LOCAL aValues  := Array( 12 )
   LOCAL aGetChk  := Array( 12 )
   LOCAL aGet     := Array( 20 )
   LOCAL aRuote   := { "Bari", "Cagliari", "Firenze", "Genova", ;
                       "Milano", "Napoli", "Palermo", "Roma", "Torino", ;
                       "Venezia", "Nazionale", "Tutte" }

   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -14 BOLD

   /*
   DEFINE DIALOG oDlg TITLE "test" SIZE nWidth, nHeight  PIXEL ;
      COLOR CLR_BLACK, CLR_WHITE  RESIZABLE FONT oFont TRANSPARENT
   */


   DEFINE DIALOG oDlg TITLE "test" SIZE nWidth, nHeight  PIXEL ;
      STYLE nOR( WS_POPUP, WS_SIZEBOX )                        ;
      COLOR CLR_BLACK, CLR_WHITE  RESIZABLE FONT oFont TRANSPARENT

   oDlg:lHelpIcon := .F.

   DEFINE BUTTONBAR oBar BUTTONSIZE 60, 30 _3DLOOK TOP OF oDlg 2015 NOBORDER

   oBar:SetFont( oFont )
   oBar:nClrText := CLR_HBLUE
   oBar:Adjust()

   DEFINE BUTTON OF oBar FILENAME "bitmaps\elabora.bmp" ;
      PROMPT " Elabora " LEFT ACTION  Elabora() GROUP

   DEFINE BUTTON OF oBar FILENAME "bitmaps\salva.bmp"   ;
      PROMPT " Salva " LEFT ACTION  Salva() GROUP

   DEFINE BUTTON OF oBar FILENAME "bitmaps\stampa.bmp"  ;
      PROMPT " Stampa " LEFT ACTION  Stampa() GROUP

   @ 20, 140 XBROWSE oBrw  PIXEL OF oDlg ;
      DATASOURCE aData AUTOCOLS CELL LINES NOBORDER FASTEDIT

   SetupBrowsePrevisioni( oBrw )
   oBrw:CreateFromCode()

   oPanel = TScrollPanel():New( 40, 5, oBrw:nHeight - 200, oBrw:nLeft - 5, oDlg )
   oPanel:WinStyle( WS_BORDER, .F. )

   oDlg:bResized := < ||
   LOCAL oRect    := oDlg:GetCliRect()
   oBar:nWidth    := oRect:nRight
   oBrw:nWidth    := oRect:nRight - 290
   oBrw:nHeight   := oRect:nBottom - 45
   oPanel:nTop    := oRect:ntop + 40
   oPanel:nLeft   := oRect:nleft + 5
   oPanel:nBottom := oBrw:nHeight - 200
   oBar:refresh()

   FOR n = 1 TO Len( oPanel:aControls )
      oPanel:aControls[ n ]:Refresh()
   NEXT

   RETURN NIL
   >

   ACTIVATE DIALOG oDlg AS MDICHILD ;
      ON INIT ( CreateOption( oPanel, @aGet, @aValues, aRuote, @aGetChk ), ;
      oPanel:SetRange(), Eval( oDlg:bResized ), SetWindowTheme( oDlg:hWnd, "", "" )   )

   oFont:End()

RETURN  NIL

FUNCTION CreatePanel( oDlg, oBrw, oPanel )

   oPanel = TScrollPanel():New( 40, 5, oDlg:nBottom - 60, oBrw:nLeft - 5, oDlg )
   oPanel:WinStyle( WS_BORDER, .F. )

RETURN oPanel

FUNCTION CreateOption( oPanel, aGet, aValues, aRuote, aGetChk )

   LOCAL nTop := 2
   LOCAL nCol := 5
   LOCAL nCol2 := 20
   LOCAL nSizew := 100
   LOCAL nSizeh := 18
   LOCAL oGrp, nChk := 0

   AFill( aValues, .F. )

   oPanel:AddText( 5, nCol, 100, 18, "Ruote attive", ,, .T., 0xC38B2B, , 1 )

   @ nTop,        ncol CHECKBOX aGetChk[ 1 ]  VAR aValues[ 1 ]   ;
      PROMPT aRuote[ 1 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 2 ]  VAR aValues[ 2 ]   ;
      PROMPT aRuote[ 2 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 3 ]  VAR aValues[ 3 ]   ;
      PROMPT aRuote[ 3 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 4 ]  VAR aValues[ 4 ]   ;
      PROMPT aRuote[ 4 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 5 ]  VAR aValues[ 5 ]   ;
      PROMPT aRuote[ 5 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol CHECKBOX aGetChk[ 6 ]  VAR aValues[ 6 ]   ;
      PROMPT aRuote[ 6 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   nTop := 2

   @ nTop,        ncol2 CHECKBOX aGetChk[ 7 ]  VAR aValues[ 7 ]   ;
      PROMPT aRuote[ 7 ]   SIZE nSizew, nSizeh OF oPanel          ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 8 ]  VAR aValues[ 8 ]   ;
       PROMPT aRuote[ 8 ]  SIZE nSizew, nSizeh OF oPanel          ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 9 ]  VAR aValues[ 9 ]   ;
      PROMPT aRuote[ 9 ]  SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 10 ] VAR aValues[ 10 ]  ;
      PROMPT aRuote[ 10 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 11 ] VAR aValues[ 11 ]  ;
      PROMPT aRuote[ 11 ] SIZE nSizew, nSizeh OF oPanel           ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY  // SCROLL ADJUST

   @ nTop += 1.7, ncol2 CHECKBOX aGetChk[ 12 ] VAR aValues[ 12 ]  ;
      PROMPT aRuote[ 12 ] SIZE nSizew, nSizeh OF oPanel           ;
      ON CHANGE ( Select_All( aGetChk, aValues[ 12 ] ) )          ;
      UPDATE COLOR CLR_GRAY, CLR_HGRAY

RETURN NIL

FUNCTION Elabora()

   MsgInfo( "elabora" )

RETURN NIL

FUNCTION Salva()

   MsgInfo( "salva" )

RETURN NIL

FUNCTION stampa()

   MsgInfo( "stampa" )

RETURN NIL

STATIC FUNCTION Select_All( aGet, lValue )

   LOCAL n

   FOR n = 1 TO Len( aGet )
      aGet[ n ]:SetCheck( lValue )
   NEXT

RETURN NIL

STATIC FUNCTION SetupBrowsePrevisioni( oBrw )

   WITH OBJECT oBrw

      AEval( :aCols, {| o, i | o:cHeader := LTrim( Str( i, 2 ) ) } )

      :nEditTypes    := EDIT_GET
      :nWidths       := 24
      :lDrawBorder := .T.
      :lHscroll            := .T.
      :lVscroll            := .T.
      :l2007               := .F.
      :l2015               := .F.

      :lAllowRowSizing     := .F.
      :lAllowColSwapping   := .F.
      :lAllowColHiding     := .F.

      // NEW
      :lAllowSizings       := .F.
      :lAutoSaves          := .T.

      :lColDividerComplete := .F.

      :nClrBorder := CLR_GRAY

      :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
      :nColDividerStyle    := LINESTYLE_LIGHTGRAY
      :bRecSelHeader    := {|| " " }
      :SetStyle( 2018 )

   END

RETURN NIL

// FIN / END
 


Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7802
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: POPUP window size

Postby Natter » Sat Apr 08, 2023 4:05 pm

Hi, karinha !

It's not really, but it helped me find a solution to my problem. Thanks !

Another question - how to make a colored outline around this window ?
Natter
 
Posts: 1211
Joined: Mon May 14, 2007 9:49 am

Re: POPUP window size

Postby karinha » Sat Apr 08, 2023 4:40 pm

Natter wrote:Hi, karinha !

It's not really, but it helped me find a solution to my problem. Thanks !

Another question - how to make a colored outline around this window ?


colored outline around this window? Would it be a SKIN()? You're too modern for me to keep up. hahahahahahaha.

contorno de color alrededor de esta ventana? ¿Sería una SKIN() ? Eres demasiado moderno para que yo te mantenga. jajajajajajaja.

Look, SKIN?.PRG

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7802
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 36 guests