how to use AddControl method

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

how to use AddControl method

Post by danielmaximiliano »

Hola a Todos:
intente usar el metodo AddControl para agregar un Textbox sin resultado alguno
busque en todos los ejemplos de HMG y Minigui sin resultado alguno. En Minigui hay un ejemplo pero solo agrega un nuevo "Page".
busque en HMG Reference pero solo encontre esto y no me dice nada a pesar que lo leo una y otra vez.

AddControl Method
Adds a control to a Tab control page

Syntax:

<WindowName>.<ControlName>.AddControl ( ControlName , nPagenumber , nRow , nCol )

me refiero a ello en http://hmgforum.com/viewtopic.php?f=12&t=1801
desde ya muchas gracias por su ayuda

TRANSLATE GOOGLE
Hi Everyone:
AddControl try to use the method to add a Textbox to no avail
look at all examples of HMG and Miniguide no avail. In Miniature Guide is an example but only adds a new "Page ".
Reference HMG search but only found this and I do not say anything even though I read it over and over again.

Method AddControl
Adds a control to a Tab control page

Syntax:

<WindowName>. <ControlName>. AddControl (ControlName, nPagenumber, nRow, nCol)

I mean this in [url] http://hmgforum.com/viewtopic.php?f=12&t=1801 [/ url]
from already thank you very much for your help
DaNiElMaXiMiLiAnO
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: how to use AddControl method

Post by Rathinagiri »

Hi,

Please try this sample and you would know how to add a control at the run time to a tab page.

Code: Select all

#include <hmg.ch>

Function Main

define window tabsample at 0,0 width 400 height 300 main
   define tab tab1 at 10,10 width 380 height 200
      define page 'Page1'
         define button ok
            row 30
            col 30
            caption 'Press here to add a acontrol'
            width 200
            action addnewcontrol()
         end button   
      end page
      define page 'Page2'
      
      end page
   end tab

end window
tabsample.center
tabsample.activate
Return

function addnewcontrol
if iscontroldefined(text1,tabsample)
   tabsample.text1.release
endif
define textbox text1
   parent tabsample
   row 50
   col 10
   width 100
end textbox
tabsample.tab1.addcontrol('text1',1,80,50)
return nil
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: how to use AddControl method

Post by danielmaximiliano »

Hola Rathi:
encontre algo similar agregando un Browser al contenedor Tab en un mail de groups.minigui
ahora el problema es cuando intento cambiar alguna propiedad me da error
en la siguiente linea

Code: Select all

Principal.&(cPage_Name).WIDTH  := GetDesktopWidth()  / 2 - 25
la misma ya fue declarada en la linea

Code: Select all

cPage_Name := 'Page_'+ltrim(str(nPage))
   Principal.Container_Tab.AddPage ( nPage, cPage_Name)
Google Translate
Hi Rathi:
I found something similar to the container by adding a Browser Tab by mail groups.minigui
Now the problem is when I try to change a property fails
in the following line

Code: Select all

 Principal. & (cPage_Name). WIDTH: = GetDesktopWidth () / 2 to 25 [/ code]
it has already been declared in line
[code] cPage_Name: = 'page_id' + ltrim (str (nPage))
    Principal.Container_Tab.AddPage (nPage, cPage_Name) [/ code]
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: how to use AddControl method

Post by danielmaximiliano »

HI.
include Source Code and Email
Attachments
Archive.rar
Email and Source Code
(2.01 KiB) Downloaded 324 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
danielmaximiliano
Posts: 2612
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: how to use AddControl method

Post by danielmaximiliano »

Hi Rathinagiri:
testing the example, I found that I need to assign "Parent " to indicate who is the objec
I will try with what I'm trying to do, a form with TAB, 2 Page, Page 1 with different controls (Textbox, Label, Image); Page 2 (to add new PAGE (addpagenews) if necessary)
this is for the application I am getting better and not have to create multiple instances of the same inquiry form
I hope it can continue as an experience for many like me who comes from tools like VFP.
this is as an example and HMG4 HMG3
thanks and a hug
Español:

probando el ejemplo, encontre que me falta asignar "Parent" para indicar de quien es el objeto
voy a probar con lo que estoy intentando hacer, un formulario con TAB , 2 Page, el Page 1 con diferentes controles (Textbox, Label, Image) ; Page 2 (para agregar nuevos PAGE (addpagenews) si son necesarios)
esto es para la aplicacion que estoy mejorando y no tener que crear multiples instancias de un mismo formulario de consulta
espero que todo esto siga como experiencia para muchos como yo que viene de herramientas como VFP.
que esto quede como un ejemplo en HMG3 y HMG4
gracias y un abrazo
DaNiElMaXiMiLiAnO
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Post Reply